Skip to content
Permalink
Browse files

Bug 8107; Fix argument handling for $.ajax for multiple method signat…

…ues and add test case
  • Loading branch information...
danheberden committed Feb 1, 2011
1 parent f43572d commit 31949fa528141dad4b92851212677b039cb23cfb
Showing with 21 additions and 3 deletions.
  1. +2 −3 src/ajax.js
  2. +19 −0 test/unit/ajax.js
@@ -322,9 +322,8 @@ jQuery.extend({
// Main method
ajax: function( url, options ) {

// If options is not an object,
// we simulate pre-1.5 signature
if ( typeof options !== "object" ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
@@ -2161,6 +2161,25 @@ test("jQuery.ajax - active counter", function() {
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 });
});

}

//}

0 comments on commit 31949fa

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.