grunt.registerTask( "lint", [ "jshint", "jscs" ] );
+ grunt.registerTask( "node_smoke_test", function() {
+ var done = this.async();
+ require( "jsdom" ).env( "", function( errors, window ) {
+ if ( errors ) {
+ console.error( errors );
+ done( false );
+ }
+ require( "./" )( window );
+ done();
+ });
+ });
+
// Short list as a high frequency watch task
grunt.registerTask( "dev", [ "build:*:*", "lint" ] );
- // Default grunt
+ grunt.registerTask( "test_fast", [ "node_smoke_test" ] );
+
+ grunt.registerTask( "test", [ "default", "test_fast" ] );
+
grunt.registerTask( "default", [ "jsonlint", "dev", "uglify", "dist:*", "compare_size" ] );
};
"grunt-jsonlint": "1.0.4",
"grunt-npmcopy": "0.1.0",
"gzip-js": "0.3.2",
+ "jsdom": "1.5.0",
"load-grunt-tasks": "1.0.0",
"npm": "2.1.12",
"qunitjs": "1.16.0",
"scripts": {
"build": "npm install && grunt",
"start": "grunt watch",
- "test": "grunt"
+ "test": "grunt test"
}
}
"sub": true,
- "browser": true,
-
"globals": {
+ "window": true,
+ "setTimeout": true,
+ "clearTimeout": true,
+ "setInterval": true,
+ "clearInterval": true,
+
"jQuery": true,
"define": true,
"module": true,
define([
"./core",
+ "./var/document",
"./var/rnotwhite",
+ "./ajax/var/location",
"./ajax/var/nonce",
"./ajax/var/rquery",
"./core/init",
"./ajax/parseJSON",
"./ajax/parseXML",
"./deferred"
-], function( jQuery, rnotwhite, nonce, rquery ) {
+], function( jQuery, document, rnotwhite, location, nonce, rquery ) {
var
rhash = /#.*$/,
// Support: IE9
try {
- xml = ( new DOMParser() ).parseFromString( data, "text/xml" );
+ xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
} catch ( e ) {
xml = undefined;
}
define([
"../core",
+ "../var/document",
"../ajax"
-], function( jQuery ) {
+], function( jQuery, document ) {
// Install script dataType
jQuery.ajaxSetup({
--- /dev/null
+define(function() {
+ return window.location;
+});
jQuery.ajaxSettings.xhr = function() {
try {
- return new XMLHttpRequest();
+ return new window.XMLHttpRequest();
} catch ( e ) {}
};
define([
+ "../var/document",
"../var/support"
-], function( support ) {
+], function( document, support ) {
(function() {
var input = document.createElement( "input" ),
define([
"./var/arr",
+ "./var/document",
"./var/slice",
"./var/concat",
"./var/push",
"./var/toString",
"./var/hasOwn",
"./var/support"
-], function( arr, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) {
+], function( arr, document, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) {
var
- // Use the correct document accordingly with window argument (sandbox)
- document = window.document,
-
version = "@VERSION",
// Define a local copy of jQuery
// Initialize a jQuery object
define([
"../core",
+ "../var/document",
"./var/rsingleTag",
"../traversing/findFilter"
-], function( jQuery, rsingleTag ) {
+], function( jQuery, document, rsingleTag ) {
// A central reference to the root jQuery(document)
var rootjQuery,
define([
"../core",
+ "../var/document",
"./var/rsingleTag",
// This is the only module that needs core/support
// buildFragment
"../manipulation"
-], function( jQuery, rsingleTag, support ) {
+], function( jQuery, document, rsingleTag, support ) {
// data: string of html
// context (optional): If specified, the fragment will be created in this context,
define([
"../core",
+ "../var/document",
"../core/init",
"../deferred"
-], function( jQuery ) {
+], function( jQuery, document ) {
// The deferred used on DOM ready
var readyList;
define([
+ "../var/document",
"../var/support"
-], function( support ) {
+], function( document, support ) {
support.createHTMLDocument = (function() {
var doc = document.implementation.createHTMLDocument( "" );
+ // Support: Node with jsdom<=1.5.0+
+ // jsdom's document created via the above method doesn't contain the body
+ if ( !doc.body ) {
+ return false;
+ }
doc.body.innerHTML = "<form></form><form></form>";
return doc.body.childNodes.length === 2;
})();
define([
"../core",
+ "../var/document",
"../manipulation" // appendTo
-], function( jQuery ) {
+], function( jQuery, document ) {
var iframe,
elemdisplay = {
define([
"../core",
+ "../var/document",
+ "../var/documentElement",
"../var/support"
-], function( jQuery, support ) {
+], function( jQuery, document, documentElement, support ) {
(function() {
var pixelPositionVal, boxSizingReliableVal,
- docElem = document.documentElement,
container = document.createElement( "div" ),
div = document.createElement( "div" );
"display:block;margin-top:1%;top:1%;" +
"border:1px;padding:1px;width:4px;position:absolute";
div.innerHTML = "";
- docElem.appendChild( container );
+ documentElement.appendChild( container );
var divStyle = window.getComputedStyle( div, null );
pixelPositionVal = divStyle.top !== "1%";
boxSizingReliableVal = divStyle.width === "4px";
- docElem.removeChild( container );
+ documentElement.removeChild( container );
}
// Support: node.js jsdom
"display:block;margin:0;border:0;padding:0";
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
- docElem.appendChild( container );
+ documentElement.appendChild( container );
ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
- docElem.removeChild( container );
+ documentElement.removeChild( container );
div.removeChild( marginDiv );
return ret;
define([
"./core",
+ "./var/document",
"./var/pnum",
"./css/var/cssExpand",
"./css/var/isHidden",
"./css",
"./deferred",
"./traversing"
-], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay, dataPriv ) {
+], function( jQuery, document, pnum, cssExpand, isHidden, defaultDisplay, dataPriv ) {
var
fxNow, timerId,
define([
"./core",
+ "./var/document",
"./var/rnotwhite",
"./var/hasOwn",
"./var/slice",
"./core/init",
"./data/accepts",
"./selector"
-], function( jQuery, rnotwhite, hasOwn, slice, support, dataPriv ) {
+], function( jQuery, document, rnotwhite, hasOwn, slice, support, dataPriv ) {
var
rkeyEvent = /^key/,
define([
+ "../var/document",
"../var/support"
-], function( support ) {
+], function( document, support ) {
(function() {
var fragment = document.createDocumentFragment(),
define([
"./core",
"./core/access",
+ "./var/document",
+ "./var/documentElement",
"./css/var/rnumnonpx",
"./css/curCSS",
"./css/addGetHookIf",
"./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
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;
});
}
});
define([
- "./core"
-], function( jQuery ) {
+ "./core",
+ "./var/document",
+ "./var/documentElement"
+], function( jQuery, document, documentElement ) {
/*
* Optional (non-Sizzle) selector module for custom builds.
*/
var hasDuplicate,
- docElem = window.document.documentElement,
- matches = docElem.matches ||
- docElem.webkitMatchesSelector ||
- docElem.mozMatchesSelector ||
- docElem.oMatchesSelector ||
- docElem.msMatchesSelector,
+ matches = documentElement.matches ||
+ documentElement.webkitMatchesSelector ||
+ documentElement.mozMatchesSelector ||
+ documentElement.oMatchesSelector ||
+ documentElement.msMatchesSelector,
sortOrder = function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
--- /dev/null
+define(function() {
+ return window.document;
+});
--- /dev/null
+define([
+ "./document"
+], function( document ) {
+ return document.documentElement;
+});