Skip to content
Permalink
Browse files

Makes sure options.context is used as the context for global ajax eve…

…nts only if it's a DOM node.
  • Loading branch information...
jaubourg committed Jan 31, 2011
1 parent 389c099 commit 485fa0c42a71b4decc9cb1ce08bb56efabcc76f3
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/ajax.js
@@ -334,13 +334,17 @@ jQuery.extend({

var // Create the final options object
s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ),
// Callbacks contexts
// Callbacks context
// We force the original context if it exists
// or take it from jQuery.ajaxSettings otherwise
// (plain objects used as context get extended)
callbackContext =
( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s,
globalEventContext = callbackContext === s ? jQuery.event : jQuery( callbackContext ),
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node
globalEventContext = callbackContext !== s && callbackContext.nodeType ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery._Deferred(),

0 comments on commit 485fa0c

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.