From 479e37f436a6676b5b52a31a54c6efe3103d73f3 Mon Sep 17 00:00:00 2001 From: TJ VanToll Date: Fri, 30 May 2014 09:48:43 -0400 Subject: [PATCH] Ajax: Support usage without jQuery.event Fixes #15118 Closes gh-1588 --- src/ajax.js | 3 ++- test/unit/ajax.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ajax.js b/src/ajax.js index 869d0fa4e..8a1b8b623 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -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 ) { diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 68628a2d3..97372c5a0 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -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: {},