git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9ab00a7
)
Revises the way arguments are handled in ajax.
author
jaubourg
<j@ubourg.net>
Thu, 20 Jan 2011 15:22:36 +0000
(16:22 +0100)
committer
jaubourg
<j@ubourg.net>
Thu, 20 Jan 2011 15:22:36 +0000
(16:22 +0100)
src/ajax.js
patch
|
blob
|
history
diff --git
a/src/ajax.js
b/src/ajax.js
index
63914d2
..
dd3c50d
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-291,18
+291,16
@@
jQuery.extend({
// Main method
ajax: function( url , options ) {
// Main method
ajax: function( url , options ) {
- // Handle varargs
- if ( arguments.length === 1 ) {
+ // If options is not an object,
+ // 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
options = options || {};
}
// Force options to be an object
options = options || {};
- // Get the url if provided separately
- options.url = url || options.url;
-
var // Create the final options object
s = jQuery.extend( true , {} , jQuery.ajaxSettings , options ),
// jQuery lists
var // Create the final options object
s = jQuery.extend( true , {} , jQuery.ajaxSettings , options ),
// jQuery lists
@@
-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
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( /\s+/ );
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( /\s+/ );