Skip to content
Permalink
Browse files

offset returns null for window and document elements. fixes #4136 again

  • Loading branch information
brandonaaron committed Apr 22, 2009
1 parent 6a04924 commit 432ea4ca6cbd63cd972718d3a44772fe8ef1022b
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/offset.js
@@ -1,7 +1,7 @@
if ( "getBoundingClientRect" in document.documentElement )
jQuery.fn.offset = function() {
var elem = this[0];
if ( !elem ) return null;
if ( !elem || !elem.ownerDocument ) return null;
if ( elem === elem.ownerDocument.body ) return jQuery.offset.bodyOffset( elem );
var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement,
clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
@@ -12,7 +12,7 @@ if ( "getBoundingClientRect" in document.documentElement )
else
jQuery.fn.offset = function() {
var elem = this[0];
if ( !elem ) return null;
if ( !elem || !elem.ownerDocument ) return null;
if ( elem === elem.ownerDocument.body ) return jQuery.offset.bodyOffset( elem );
jQuery.offset.initialize();

0 comments on commit 432ea4c

Please sign in to comment.
You can’t perform that action at this time.