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" ) &&
expected++;
attrObj[ "offset" ] = { "top": 1, "left": 1 };
}
+ if ( jQuery.fn.offset ) {
+ expected++;
+ attrObj["offset"] = { "top": 1, "left": 1 };
+ }
if ( jQuery.fn.css ) {
expected += 2;
attrObj[ "css" ] = { "paddingLeft": 1, "paddingRight": 1 };
elem = jQuery( "\n\n<em>world</em>" )[ 0 ];
assert.equal( elem.nodeName.toLowerCase(), "em", "leading newlines" );
- elem = jQuery( "<div/>", attrObj );
+ elem = jQuery("<div/>", attrObj );
if ( jQuery.fn.width ) {
assert.equal( elem[ 0 ].style.width, "10px", "jQuery() quick setter width" );
assert.equal( elem[ 0 ].style.top, "1px", "jQuery() quick setter offset" );
}
+ 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" );