Build: Don't assume the browser environment; smoke test on Node w/ jsdom

Fixes gh-1950
Closes gh-1949
This commit is contained in:
Michał Gołębiowski
2014-09-11 15:18:34 -05:00
committed by Michał Gołębiowski
parent ab20d9d24f
commit 76df9e4e38
23 changed files with 88 additions and 40 deletions

View File

@@ -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;
});
}
});