Revert "Offset: allow offset setter to throw for disconnected elements"

This reverts commit 0d11c1182f.
This commit is contained in:
Oleg Gaidarenko 2015-11-13 14:54:33 +03:00
parent e4218ca10b
commit aaff6a87a1
2 changed files with 10 additions and 2 deletions

View File

@ -32,7 +32,7 @@ jQuery.offset = {
elem.style.position = "relative";
}
curOffset = curElem.offset();
curOffset = curElem.offset() || { top: 0, left: 0 };
curCSSTop = jQuery.css( elem, "top" );
curCSSLeft = jQuery.css( elem, "left" );
calculatePosition = ( position === "absolute" || position === "fixed" ) &&

View File

@ -36,6 +36,10 @@ QUnit.test( "jQuery()", function( assert ) {
expected++;
attrObj[ "width" ] = 10;
}
if ( jQuery.fn.offset ) {
expected++;
attrObj["offset"] = { "top": 1, "left": 1 };
}
if ( jQuery.fn.css ) {
expected += 2;
attrObj[ "css" ] = { "paddingLeft": 1, "paddingRight": 1 };
@ -107,6 +111,10 @@ QUnit.test( "jQuery()", function( assert ) {
assert.equal( elem[ 0 ].style.width, "10px", "jQuery() quick setter width" );
}
if ( jQuery.fn.offset ) {
equal( elem[0].style.top, "1px", "jQuery() quick setter offset");
}
if ( jQuery.fn.css ) {
assert.equal( elem[ 0 ].style.paddingLeft, "1px", "jQuery quick setter css" );
assert.equal( elem[ 0 ].style.paddingRight, "1px", "jQuery quick setter css" );