Adds jQuery collection to objects that will be used as global events context if provided in the ajax options.

This commit is contained in:
jaubourg 2011-02-07 17:09:47 +01:00
parent a2dbdc1f54
commit 5b421fed00

View File

@ -365,9 +365,10 @@ jQuery.extend({
( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s,
// 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,
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery._Deferred(),