Commit 3e1d3d0f authored by jaubourg's avatar jaubourg

Revises the way arguments are handled in ajax.

parent 9ab00a71
...@@ -291,18 +291,16 @@ jQuery.extend({ ...@@ -291,18 +291,16 @@ jQuery.extend({
// Main method // Main method
ajax: function( url , options ) { ajax: function( url , options ) {
// Handle varargs // If options is not an object,
if ( arguments.length === 1 ) { // we simulate pre-1.5 signature
if ( typeof( options ) !== "object" ) {
options = url; options = url;
url = options ? options.url : undefined; url = undefined;
} }
// Force options to be an object // Force options to be an object
options = options || {}; options = options || {};
// Get the url if provided separately
options.url = url || options.url;
var // Create the final options object var // Create the final options object
s = jQuery.extend( true , {} , jQuery.ajaxSettings , options ), s = jQuery.extend( true , {} , jQuery.ajaxSettings , options ),
// jQuery lists // jQuery lists
...@@ -630,7 +628,8 @@ jQuery.extend({ ...@@ -630,7 +628,8 @@ jQuery.extend({
}; };
// Remove hash character (#7531: and string promotion) // Remove hash character (#7531: and string promotion)
s.url = ( "" + s.url ).replace( rhash , "" ); // We also use the url parameter if available
s.url = ( "" + ( url || s.url ) ).replace( rhash , "" );
// Extract dataTypes list // Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( /\s+/ ); s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( /\s+/ );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment