Make sure original context is maintained and not the deep extended one. Fixes #5924.
This commit is contained in:
parent
f91b944cab
commit
1a14a38ff7
|
@ -206,7 +206,7 @@ jQuery.extend({
|
||||||
var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
|
var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
|
||||||
|
|
||||||
var jsonp, status, data,
|
var jsonp, status, data,
|
||||||
callbackContext = s.context || s,
|
callbackContext = origSettings && origSettings.context || s,
|
||||||
type = s.type.toUpperCase();
|
type = s.type.toUpperCase();
|
||||||
|
|
||||||
// convert data if not already a string
|
// convert data if not already a string
|
||||||
|
|
|
@ -180,6 +180,27 @@ test("Ajax events with context", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("jQuery.ajax context modification", function() {
|
||||||
|
expect(1);
|
||||||
|
|
||||||
|
stop();
|
||||||
|
|
||||||
|
var obj = {}
|
||||||
|
|
||||||
|
jQuery.ajax({
|
||||||
|
url: url("data/name.html"),
|
||||||
|
context: obj,
|
||||||
|
beforeSend: function(){
|
||||||
|
this.test = "foo";
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
equals( obj.test, "foo", "Make sure the original object is maintained." );
|
||||||
|
});
|
||||||
|
|
||||||
test("jQuery.ajax() - disabled globals", function() {
|
test("jQuery.ajax() - disabled globals", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
stop();
|
stop();
|
||||||
|
|
Loading…
Reference in a new issue