Skip to content

Commit

Permalink
Ajax: Support usage without jQuery.event
Browse files Browse the repository at this point in the history
Fixes #15118
Closes jquerygh-1588
  • Loading branch information
tjvantoll committed Jun 2, 2014
1 parent 97c803a commit d41e819
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ajax.js
Expand Up @@ -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 ) {
Expand Down
16 changes: 16 additions & 0 deletions test/unit/ajax.js
Expand Up @@ -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: {},
Expand Down

0 comments on commit d41e819

Please sign in to comment.