aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichał Gołębiowski <m.goleb@gmail.com>2015-06-14 19:21:57 +0200
committerMichał Gołębiowski <m.goleb@gmail.com>2015-06-17 12:29:49 +0200
commit219c7494938a10b985b7827990bc419e41585b10 (patch)
tree9e305db6cae35cf26a2b9e4367d3632b2a4b8793 /src
parentb04124222395a05c80d4f1c3a70333fdb07bfe3d (diff)
downloadjquery-219c7494938a10b985b7827990bc419e41585b10.tar.gz
jquery-219c7494938a10b985b7827990bc419e41585b10.zip
Core: Use window.setTimeout & friends instead of global equivalents
Fixes gh-2177
Diffstat (limited to 'src')
-rw-r--r--src/.jshintrc4
-rw-r--r--src/ajax.js5
-rw-r--r--src/core/ready.js3
-rw-r--r--src/deferred.js3
-rw-r--r--src/effects.js6
-rw-r--r--src/queue/delay.js4
-rw-r--r--src/var/clearInterval.js3
-rw-r--r--src/var/clearTimeout.js3
-rw-r--r--src/var/setInterval.js3
-rw-r--r--src/var/setTimeout.js3
10 files changed, 28 insertions, 9 deletions
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;
+});