mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Makes sure options.context is used as the context for global ajax events only if it's a DOM node.
This commit is contained in:
parent
389c099df6
commit
485fa0c42a
@ -334,13 +334,17 @@ jQuery.extend({
|
|||||||
|
|
||||||
var // Create the final options object
|
var // Create the final options object
|
||||||
s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ),
|
s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ),
|
||||||
// Callbacks contexts
|
// Callbacks context
|
||||||
// We force the original context if it exists
|
// We force the original context if it exists
|
||||||
// or take it from jQuery.ajaxSettings otherwise
|
// or take it from jQuery.ajaxSettings otherwise
|
||||||
// (plain objects used as context get extended)
|
// (plain objects used as context get extended)
|
||||||
callbackContext =
|
callbackContext =
|
||||||
( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s,
|
( 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
|
// Deferreds
|
||||||
deferred = jQuery.Deferred(),
|
deferred = jQuery.Deferred(),
|
||||||
completeDeferred = jQuery._Deferred(),
|
completeDeferred = jQuery._Deferred(),
|
||||||
|
Loading…
Reference in New Issue
Block a user