From: Michał Gołębiowski Date: Sun, 14 Jun 2015 17:21:57 +0000 (+0200) Subject: Core: Use window.setTimeout & friends instead of global equivalents X-Git-Tag: 3.0.0-alpha1~18 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F2397%2Fhead;p=jquery.git Core: Use window.setTimeout & friends instead of global equivalents Fixes gh-2177 --- diff --git a/src/.jshintrc b/src/.jshintrc index a48233b29..6144bf420 100644 --- a/src/.jshintrc +++ b/src/.jshintrc @@ -14,10 +14,6 @@ "globals": { "window": true, - "setTimeout": true, - "clearTimeout": true, - "setInterval": true, - "clearInterval": true, "jQuery": true, "define": true, diff --git a/src/ajax.js b/src/ajax.js index 70bb49691..21668165e 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -2,6 +2,8 @@ define([ "./core", "./var/document", "./var/rnotwhite", + "./var/setTimeout", + "./var/clearTimeout", "./ajax/var/location", "./ajax/var/nonce", "./ajax/var/rquery", @@ -9,7 +11,8 @@ define([ "./ajax/parseJSON", "./ajax/parseXML", "./deferred" -], function( jQuery, document, rnotwhite, location, nonce, rquery ) { +], function( jQuery, document, rnotwhite, setTimeout, clearTimeout, + location, nonce, rquery ) { var rhash = /#.*$/, diff --git a/src/core/ready.js b/src/core/ready.js index bea0496da..b78b474cd 100644 --- a/src/core/ready.js +++ b/src/core/ready.js @@ -1,8 +1,9 @@ define([ "../core", "../var/document", + "../var/setTimeout", "../deferred" -], function( jQuery, document ) { +], function( jQuery, document, setTimeout ) { // The deferred used on DOM ready var readyList; diff --git a/src/deferred.js b/src/deferred.js index cdb7f1cc4..043bf0c04 100644 --- a/src/deferred.js +++ b/src/deferred.js @@ -1,8 +1,9 @@ define([ "./core", "./var/slice", + "./var/setTimeout", "./callbacks" -], function( jQuery, slice ) { +], function( jQuery, slice, setTimeout ) { function Identity( v ) { return v; diff --git a/src/effects.js b/src/effects.js index 3268fcda9..63874fe78 100644 --- a/src/effects.js +++ b/src/effects.js @@ -2,6 +2,9 @@ define([ "./core", "./var/document", "./var/rcssNum", + "./var/setInterval", + "./var/clearInterval", + "./var/setTimeout", "./css/var/cssExpand", "./css/var/isHidden", "./css/var/swap", @@ -16,7 +19,8 @@ define([ "./manipulation", "./css", "./effects/Tween" -], function( jQuery, document, rcssNum, cssExpand, isHidden, swap, adjustCSS, dataPriv, showHide ) { +], function( jQuery, document, rcssNum, setInterval, clearInterval, setTimeout, + cssExpand, isHidden, swap, adjustCSS, dataPriv, showHide ) { var fxNow, timerId, diff --git a/src/queue/delay.js b/src/queue/delay.js index 037ef0998..d2aa7e409 100644 --- a/src/queue/delay.js +++ b/src/queue/delay.js @@ -1,8 +1,10 @@ define([ "../core", + "../var/setTimeout", + "../var/clearTimeout", "../queue", "../effects" // Delay is optional because of this dependency -], function( jQuery ) { +], function( jQuery, setTimeout, clearTimeout ) { // Based off of the plugin by Clint Helfers, with permission. // http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ diff --git a/src/var/clearInterval.js b/src/var/clearInterval.js new file mode 100644 index 000000000..b8fcf3155 --- /dev/null +++ b/src/var/clearInterval.js @@ -0,0 +1,3 @@ +define(function() { + return window.clearInterval; +}); diff --git a/src/var/clearTimeout.js b/src/var/clearTimeout.js new file mode 100644 index 000000000..ab77b074a --- /dev/null +++ b/src/var/clearTimeout.js @@ -0,0 +1,3 @@ +define(function() { + return window.clearTimeout; +}); diff --git a/src/var/setInterval.js b/src/var/setInterval.js new file mode 100644 index 000000000..7d9906b1d --- /dev/null +++ b/src/var/setInterval.js @@ -0,0 +1,3 @@ +define(function() { + return window.setInterval; +}); diff --git a/src/var/setTimeout.js b/src/var/setTimeout.js new file mode 100644 index 000000000..cda6b55ad --- /dev/null +++ b/src/var/setTimeout.js @@ -0,0 +1,3 @@ +define(function() { + return window.setTimeout; +});