X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Foffset.js;h=f80574eeae562a4207c9c2a52c6a23bc55d2c51f;hb=2c28f229e5eb49f1469fd36ee979529a492f0f42;hp=c3183743b2c27e46ecf3ffc5c119674732acb586;hpb=a63754aa4e4e430007208d6b5cb76f9ca8c279f5;p=jquery.git diff --git a/src/offset.js b/src/offset.js index c318374..f80574e 100644 --- a/src/offset.js +++ b/src/offset.js @@ -2,16 +2,16 @@ if ( "getBoundingClientRect" in document.documentElement ) { jQuery.fn.offset = function( options ) { var elem = this[0]; - if ( !elem || !elem.ownerDocument ) { - return null; - } - if ( options ) { return this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } + if ( !elem || !elem.ownerDocument ) { + return null; + } + if ( elem === elem.ownerDocument.body ) { return jQuery.offset.bodyOffset( elem ); } @@ -28,16 +28,16 @@ if ( "getBoundingClientRect" in document.documentElement ) { jQuery.fn.offset = function( options ) { var elem = this[0]; - if ( !elem || !elem.ownerDocument ) { - return null; - } - if ( options ) { return this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } + if ( !elem || !elem.ownerDocument ) { + return null; + } + if ( elem === elem.ownerDocument.body ) { return jQuery.offset.bodyOffset( elem ); }