Core: Use window.setTimeout & friends instead of global equivalents

Fixes gh-2177
This commit is contained in:
Michał Gołębiowski
2015-06-14 19:21:57 +02:00
parent b041242223
commit 219c749493
10 changed files with 28 additions and 9 deletions

View File

@@ -14,10 +14,6 @@
"globals": {
"window": true,
"setTimeout": true,
"clearTimeout": true,
"setInterval": true,
"clearInterval": true,
"jQuery": true,
"define": true,

View File

@@ -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 = /#.*$/,

View File

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

View File

@@ -1,8 +1,9 @@
define([
"./core",
"./var/slice",
"./var/setTimeout",
"./callbacks"
], function( jQuery, slice ) {
], function( jQuery, slice, setTimeout ) {
function Identity( v ) {
return v;

6
src/effects.js vendored
View File

@@ -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,

View File

@@ -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/

3
src/var/clearInterval.js Normal file
View File

@@ -0,0 +1,3 @@
define(function() {
return window.clearInterval;
});

3
src/var/clearTimeout.js Normal file
View File

@@ -0,0 +1,3 @@
define(function() {
return window.clearTimeout;
});

3
src/var/setInterval.js Normal file
View File

@@ -0,0 +1,3 @@
define(function() {
return window.setInterval;
});

3
src/var/setTimeout.js Normal file
View File

@@ -0,0 +1,3 @@
define(function() {
return window.setTimeout;
});