mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Bug 8107; Fix argument handling for $.ajax for multiple method signatues and add test case
This commit is contained in:
parent
f43572d3b8
commit
31949fa528
@ -322,9 +322,8 @@ jQuery.extend({
|
|||||||
// Main method
|
// Main method
|
||||||
ajax: function( url, options ) {
|
ajax: function( url, options ) {
|
||||||
|
|
||||||
// If options is not an object,
|
// If url is an object, simulate pre-1.5 signature
|
||||||
// we simulate pre-1.5 signature
|
if ( typeof url === "object" ) {
|
||||||
if ( typeof options !== "object" ) {
|
|
||||||
options = url;
|
options = url;
|
||||||
url = undefined;
|
url = undefined;
|
||||||
}
|
}
|
||||||
|
@ -2161,6 +2161,25 @@ test("jQuery.ajax - active counter", function() {
|
|||||||
ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
|
ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( "jQuery.ajax - multiple method signatures introduced in 1.5 ( #8107)", 4, function() {
|
||||||
|
|
||||||
|
expect( 3 );
|
||||||
|
|
||||||
|
var i = 3;
|
||||||
|
|
||||||
|
jQuery.ajaxSetup({success: function() {
|
||||||
|
ok( true, "Success");
|
||||||
|
if ( ! --i ) start();
|
||||||
|
}});
|
||||||
|
|
||||||
|
stop();
|
||||||
|
jQuery.ajax('data/name.html');
|
||||||
|
jQuery.ajax('data/name.html', {} );
|
||||||
|
jQuery.ajax({ url: 'data/name.html'} );
|
||||||
|
|
||||||
|
jQuery.ajaxSetup({ success: null });
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//}
|
//}
|
Loading…
Reference in New Issue
Block a user