]> source.dussan.org Git - jquery.git/commitdiff
Ajax: Support usage without jQuery.event
authorTJ VanToll <tj.vantoll@gmail.com>
Fri, 30 May 2014 13:48:43 +0000 (09:48 -0400)
committerTimmy Willison <timmywillisn@gmail.com>
Mon, 2 Jun 2014 20:41:00 +0000 (16:41 -0400)
Fixes #15118
Closes gh-1588

src/ajax.js
test/unit/ajax.js

index 869d0fa4e9dbe2b7f0adb2dbd868b5b560dde412..8a1b8b6238ade328fb4c30d4a49348e880877cb6 100644 (file)
@@ -537,7 +537,8 @@ jQuery.extend({
                }
 
                // We can fire global events as of now if asked to
-               fireGlobals = s.global;
+               // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
+               fireGlobals = jQuery.event && s.global;
 
                // Watch for a new set of requests
                if ( fireGlobals && jQuery.active++ === 0 ) {
index 68628a2d35a6dec524d0ae318ffea7826a759969..97372c5a07c5aaf467e6dfb96ecc0d6cbd6ca5de 100644 (file)
@@ -415,6 +415,22 @@ module( "ajax", {
                };
        });
 
+       ajaxTest( "#15118 - jQuery.ajax() - function without jQuery.event", 1, function() {
+               var holder;
+               return {
+                       url: url( "data/json.php" ),
+                       setup: function() {
+                               holder = jQuery.event;
+                               delete jQuery.event;
+                       },
+                       complete: function() {
+                               ok( true, "Call can be made without jQuery.event" );
+                               jQuery.event = holder;
+                       },
+                       success: true
+               };
+       });
+
        ajaxTest( "jQuery.ajax() - context modification", 1, {
                url: url("data/name.html"),
                context: {},