Skip to content
Permalink
Browse files

Bug #8107; Fix $.ajax argument handling for new 1.5 signature

  • Loading branch information
danheberden committed Feb 1, 2011
1 parent eff5329 commit 397392958a7c9d90c17fc6b67bae6589eea909a5
Showing with 25 additions and 2 deletions.
  1. +2 −2 src/ajax.js
  2. +23 −0 test/unit/ajax.js
@@ -322,9 +322,9 @@ jQuery.extend({
// Main method
ajax: function( url, options ) {

// If options is not an object,
// If url is an object,
// we simulate pre-1.5 signature
if ( typeof options !== "object" ) {
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
@@ -1969,6 +1969,25 @@ jQuery.each( { " (cache)": true, " (no cache)": false }, function( label, cache
});
});

test( "jQuery.ajax - 1.4 and previous signature and 1.5 optional signature ( #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 });
});

test("jQuery ajax - failing cross-domain", function() {

expect( 2 );
@@ -1993,6 +2012,8 @@ test("jQuery ajax - failing cross-domain", function() {

});



test("jQuery ajax - atom+xml", function() {

stop();
@@ -2006,6 +2027,8 @@ test("jQuery ajax - atom+xml", function() {

});



test( "jQuery.ajax - Location object as url (#7531)", 1, function () {
var success = false;
try {

0 comments on commit 3973929

Please sign in to comment.
You can’t perform that action at this time.