Core: Support non-browser environments

Fixes gh-2133
Fixes gh-2501
Closes gh-2504
Refs gh-1950
Refs gh-1949
Refs gh-2397
Refs gh-1537
Refs gh-2504
Refs 842958e7ae
This commit is contained in:
Michał Gołębiowski
2015-07-28 12:58:44 +02:00
parent 9b04201ff2
commit 04ec688e80
45 changed files with 363 additions and 68 deletions

View File

@@ -1,7 +1,8 @@
define([
"../core",
"../var/document",
"../deferred"
], function( jQuery ) {
], function( jQuery, document ) {
// The deferred used on DOM ready
var readyList;
@@ -72,7 +73,7 @@ function detach() {
function completed() {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener ||
event.type === "load" ||
window.event.type === "load" ||
document.readyState === "complete" ) {
detach();
@@ -93,7 +94,7 @@ jQuery.ready.promise = function( obj ) {
// http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
window.setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {