aboutsummaryrefslogtreecommitdiffstats
path: root/src/offset.js
diff options
context:
space:
mode:
authorBrandon Aaron <brandon.aaron@gmail.com>2009-04-22 05:29:01 +0000
committerBrandon Aaron <brandon.aaron@gmail.com>2009-04-22 05:29:01 +0000
commit432ea4ca6cbd63cd972718d3a44772fe8ef1022b (patch)
treecaa25020a5609e775c359d0df77fa06324357d57 /src/offset.js
parent6a049246a123d7da75430f875e9eee1ba3270722 (diff)
downloadjquery-432ea4ca6cbd63cd972718d3a44772fe8ef1022b.tar.gz
jquery-432ea4ca6cbd63cd972718d3a44772fe8ef1022b.zip
offset returns null for window and document elements. fixes #4136 again
Diffstat (limited to 'src/offset.js')
-rw-r--r--src/offset.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/offset.js b/src/offset.js
index 92eace907..964844e7d 100644
--- a/src/offset.js
+++ b/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();