From 97c803acfb667f74774450e93666d9596f92bbf5 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Mon, 2 Jun 2014 12:39:11 -0400 Subject: [PATCH] Ajax: move ajax event aliases to their own file Fixes #15126 --- Gruntfile.js | 2 +- src/ajax.js | 7 ------- src/event/ajax.js | 13 +++++++++++++ src/jquery.js | 1 + 4 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 src/event/ajax.js diff --git a/Gruntfile.js b/Gruntfile.js index 1527206f1..0bee7a8e8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -39,7 +39,7 @@ module.exports = function( grunt ) { ], // Exclude specified modules if the module matching the key is removed removeWith: { - ajax: [ "manipulation/_evalUrl" ], + ajax: [ "manipulation/_evalUrl", "event/ajax" ], callbacks: [ "deferred" ], css: [ "effects", "dimensions", "offset" ], sizzle: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ] diff --git a/src/ajax.js b/src/ajax.js index d39de2a9b..502b33b2a 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -795,12 +795,5 @@ jQuery.each( [ "get", "post" ], function( i, method ) { }; }); -// Attach a bunch of functions for handling common AJAX events -jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { - jQuery.fn[ type ] = function( fn ) { - return this.on( type, fn ); - }; -}); - return jQuery; }); diff --git a/src/event/ajax.js b/src/event/ajax.js new file mode 100644 index 000000000..278c403ee --- /dev/null +++ b/src/event/ajax.js @@ -0,0 +1,13 @@ +define([ + "../core", + "../event" +], function( jQuery ) { + +// Attach a bunch of functions for handling common AJAX events +jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { + jQuery.fn[ type ] = function( fn ) { + return this.on( type, fn ); + }; +}); + +}); diff --git a/src/jquery.js b/src/jquery.js index 46460fa96..d3857e955 100644 --- a/src/jquery.js +++ b/src/jquery.js @@ -22,6 +22,7 @@ define([ "./ajax/script", "./ajax/jsonp", "./ajax/load", + "./event/ajax", "./effects", "./effects/animatedSelector", "./offset", -- 2.39.5