]> source.dussan.org Git - jquery.git/commitdiff
Core: Switch from modules to just window.setTimeout etc.
authorMichał Gołębiowski <m.goleb@gmail.com>
Wed, 17 Jun 2015 10:55:59 +0000 (12:55 +0200)
committerMichał Gołębiowski <m.goleb@gmail.com>
Wed, 17 Jun 2015 10:59:01 +0000 (12:59 +0200)
Using modules for window.setTimeout etc. made those functions cached and
disabled Sinon mocking, making effects tests fail. Just writing
window.setTimeout directly is smaller anyway.

src/ajax.js
src/core/ready.js
src/deferred.js
src/effects.js
src/queue/delay.js
src/var/clearInterval.js [deleted file]
src/var/clearTimeout.js [deleted file]
src/var/setInterval.js [deleted file]
src/var/setTimeout.js [deleted file]

index 21668165e6962d320ac4c30c52264193b6fb993b..9c1d6ca85300a55a3f3e74f022c04b1f9c8267ed 100644 (file)
@@ -2,8 +2,6 @@ define([
        "./core",
        "./var/document",
        "./var/rnotwhite",
-       "./var/setTimeout",
-       "./var/clearTimeout",
        "./ajax/var/location",
        "./ajax/var/nonce",
        "./ajax/var/rquery",
@@ -11,8 +9,7 @@ define([
        "./ajax/parseJSON",
        "./ajax/parseXML",
        "./deferred"
-], function( jQuery, document, rnotwhite, setTimeout, clearTimeout,
-       location, nonce, rquery ) {
+], function( jQuery, document, rnotwhite, location, nonce, rquery ) {
 
 var
        rhash = /#.*$/,
@@ -645,7 +642,7 @@ jQuery.extend({
 
                        // Timeout
                        if ( s.async && s.timeout > 0 ) {
-                               timeoutTimer = setTimeout(function() {
+                               timeoutTimer = window.setTimeout(function() {
                                        jqXHR.abort("timeout");
                                }, s.timeout );
                        }
@@ -679,7 +676,7 @@ jQuery.extend({
 
                        // Clear timeout if it exists
                        if ( timeoutTimer ) {
-                               clearTimeout( timeoutTimer );
+                               window.clearTimeout( timeoutTimer );
                        }
 
                        // Dereference transport for early garbage collection
index b78b474cdb8671a0784159d10fefc8fdfde2c0e5..085d19a931ff2a2d7f486b235411514898c5c321 100644 (file)
@@ -1,9 +1,8 @@
 define([
        "../core",
        "../var/document",
-       "../var/setTimeout",
        "../deferred"
-], function( jQuery, document, setTimeout ) {
+], function( jQuery, document ) {
 
 // The deferred used on DOM ready
 var readyList;
@@ -74,7 +73,7 @@ jQuery.ready.promise = function( obj ) {
                // discovered by ChrisS here: 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 );
 
                } else {
 
index 043bf0c04d5e81e0400811e24e596daced0f8bdd..188303c9759137a7340e365c9f5300e1c91e9281 100644 (file)
@@ -1,9 +1,8 @@
 define([
        "./core",
        "./var/slice",
-       "./var/setTimeout",
        "./callbacks"
-], function( jQuery, slice, setTimeout ) {
+], function( jQuery, slice ) {
 
 function Identity( v ) {
        return v;
@@ -174,7 +173,7 @@ jQuery.extend({
                                                        if ( depth ) {
                                                                process();
                                                        } else {
-                                                               setTimeout( process );
+                                                               window.setTimeout( process );
                                                        }
                                                };
                                        }
index 63874fe78e8c8a93f0b47ca963cd5ca3d2db6d5d..53b73fd848bdfb2650b6af62c2261883347608d7 100644 (file)
@@ -2,9 +2,6 @@ define([
        "./core",
        "./var/document",
        "./var/rcssNum",
-       "./var/setInterval",
-       "./var/clearInterval",
-       "./var/setTimeout",
        "./css/var/cssExpand",
        "./css/var/isHidden",
        "./css/var/swap",
@@ -19,8 +16,7 @@ define([
        "./manipulation",
        "./css",
        "./effects/Tween"
-], function( jQuery, document, rcssNum, setInterval, clearInterval, setTimeout,
-       cssExpand, isHidden, swap, adjustCSS, dataPriv, showHide ) {
+], function( jQuery, document, rcssNum, cssExpand, isHidden, swap, adjustCSS, dataPriv, showHide ) {
 
 var
        fxNow, timerId,
@@ -44,7 +40,7 @@ function raf() {
 
 // Animations created synchronously will run synchronously
 function createFxNow() {
-       setTimeout(function() {
+       window.setTimeout(function() {
                fxNow = undefined;
        });
        return ( fxNow = jQuery.now() );
@@ -638,7 +634,7 @@ jQuery.fx.start = function() {
        if ( !timerId ) {
                timerId = window.requestAnimationFrame ?
                        window.requestAnimationFrame( raf ) :
-                       setInterval( jQuery.fx.tick, jQuery.fx.interval );
+                       window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
        }
 };
 
@@ -646,7 +642,7 @@ jQuery.fx.stop = function() {
        if ( window.cancelAnimationFrame ) {
                window.cancelAnimationFrame( timerId );
        } else {
-               clearInterval( timerId );
+               window.clearInterval( timerId );
        }
 
        timerId = null;
index d2aa7e4092fd9ac712e942a0f079b8b6798421f7..93abd0bf26cda1459562120dada098bae4300fe4 100644 (file)
@@ -1,10 +1,8 @@
 define([
        "../core",
-       "../var/setTimeout",
-       "../var/clearTimeout",
        "../queue",
        "../effects" // Delay is optional because of this dependency
-], function( jQuery, setTimeout, clearTimeout ) {
+], function( jQuery ) {
 
 // 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/
@@ -13,9 +11,9 @@ jQuery.fn.delay = function( time, type ) {
        type = type || "fx";
 
        return this.queue( type, function( next, hooks ) {
-               var timeout = setTimeout( next, time );
+               var timeout = window.setTimeout( next, time );
                hooks.stop = function() {
-                       clearTimeout( timeout );
+                       window.clearTimeout( timeout );
                };
        });
 };
diff --git a/src/var/clearInterval.js b/src/var/clearInterval.js
deleted file mode 100644 (file)
index b8fcf31..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-define(function() {
-       return window.clearInterval;
-});
diff --git a/src/var/clearTimeout.js b/src/var/clearTimeout.js
deleted file mode 100644 (file)
index ab77b07..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-define(function() {
-       return window.clearTimeout;
-});
diff --git a/src/var/setInterval.js b/src/var/setInterval.js
deleted file mode 100644 (file)
index 7d9906b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-define(function() {
-       return window.setInterval;
-});
diff --git a/src/var/setTimeout.js b/src/var/setTimeout.js
deleted file mode 100644 (file)
index cda6b55..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-define(function() {
-       return window.setTimeout;
-});