git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
389c099
)
Makes sure options.context is used as the context for global ajax events only if...
author
jaubourg
<j@ubourg.net>
Mon, 31 Jan 2011 16:23:36 +0000
(17:23 +0100)
committer
jaubourg
<j@ubourg.net>
Mon, 31 Jan 2011 16:40:26 +0000
(17:40 +0100)
src/ajax.js
patch
|
blob
|
history
diff --git
a/src/ajax.js
b/src/ajax.js
index
4258b67
..
11eacee
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-334,13
+334,17
@@
jQuery.extend({
var // Create the final options object
s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ),
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,
// 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(),
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery._Deferred(),