From: TJ VanToll Date: Fri, 30 May 2014 13:48:43 +0000 (-0400) Subject: Ajax: Support usage without jQuery.event X-Git-Tag: 2.1.2~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d41e81980ea89e56c04eb14d8c27f4692b367604;p=jquery.git Ajax: Support usage without jQuery.event Fixes #15118 Closes gh-1588 --- diff --git a/src/ajax.js b/src/ajax.js index 502b33b2a..0d0644b92 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -536,7 +536,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 ) { diff --git a/test/unit/ajax.js b/test/unit/ajax.js index a332c929c..0f6de4696 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -420,6 +420,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: {},