diff options
author | Michał Gołębiowski <m.goleb@gmail.com> | 2014-09-11 15:18:34 -0500 |
---|---|---|
committer | Michał Gołębiowski <m.goleb@gmail.com> | 2014-12-26 13:26:46 +0100 |
commit | 76df9e4e389d80bff410a9e5f08b848de1d21a2f (patch) | |
tree | 215a453aac2f1cc5574f66173e91d391493146d3 /src/offset.js | |
parent | ab20d9d24f0a95df382c02e9ef3dcc4adb86e4f1 (diff) | |
download | jquery-76df9e4e389d80bff410a9e5f08b848de1d21a2f.tar.gz jquery-76df9e4e389d80bff410a9e5f08b848de1d21a2f.zip |
Build: Don't assume the browser environment; smoke test on Node w/ jsdom
Fixes gh-1950
Closes gh-1949
Diffstat (limited to 'src/offset.js')
-rw-r--r-- | src/offset.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/offset.js b/src/offset.js index f4b478f10..e7cb23929 100644 --- a/src/offset.js +++ b/src/offset.js @@ -1,6 +1,8 @@ define([ "./core", "./core/access", + "./var/document", + "./var/documentElement", "./css/var/rnumnonpx", "./css/curCSS", "./css/addGetHookIf", @@ -9,9 +11,7 @@ define([ "./core/init", "./css", "./selector" // contains -], function( jQuery, access, rnumnonpx, curCSS, addGetHookIf, support ) { - -var docElem = window.document.documentElement; +], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) { /** * Gets a window from an element @@ -145,14 +145,14 @@ jQuery.fn.extend({ offsetParent: function() { return this.map(function() { - var offsetParent = this.offsetParent || docElem; + var offsetParent = this.offsetParent || documentElement; while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { offsetParent = offsetParent.offsetParent; } - return offsetParent || docElem; + return offsetParent || documentElement; }); } }); |