git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
jquery core: closes #3541. Added isArray.
[jquery.git]
/
src
/
ajax.js
diff --git
a/src/ajax.js
b/src/ajax.js
index
885c819
..
7e024a3
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-12,8
+12,6
@@
jQuery.fn.extend({
url = url.slice(0, off);
}
url = url.slice(0, off);
}
- callback = callback || function(){};
-
// Default to a GET request
var type = "GET";
// Default to a GET request
var type = "GET";
@@
-56,7
+54,8
@@
jQuery.fn.extend({
// If not, just inject the full result
res.responseText );
// If not, just inject the full result
res.responseText );
- self.each( callback, [res.responseText, status, res] );
+ if( callback )
+ self.each( callback, [res.responseText, status, res] );
}
});
return this;
}
});
return this;
@@
-67,8
+66,7
@@
jQuery.fn.extend({
},
serializeArray: function() {
return this.map(function(){
},
serializeArray: function() {
return this.map(function(){
- return jQuery.nodeName(this, "form") ?
- jQuery.makeArray(this.elements) : this;
+ return this.elements ? jQuery.makeArray(this.elements) : this;
})
.filter(function(){
return this.name && !this.disabled &&
})
.filter(function(){
return this.name && !this.disabled &&
@@
-78,7
+76,7
@@
jQuery.fn.extend({
.map(function(i, elem){
var val = jQuery(this).val();
return val == null ? null :
.map(function(i, elem){
var val = jQuery(this).val();
return val == null ? null :
- val.constructor == Array ?
+ jQuery.isArray(val) ?
jQuery.map( val, function(val, i){
return {name: elem.name, value: val};
}) :
jQuery.map( val, function(val, i){
return {name: elem.name, value: val};
}) :
@@
-506,7
+504,7
@@
jQuery.extend({
// If an array was passed in, assume that it is an array
// of form elements
// If an array was passed in, assume that it is an array
// of form elements
- if ( a.constructor == Array || a.jquery )
+ if ( jQuery.isArray(a) || a.jquery )
// Serialize the form elements
jQuery.each( a, function(){
add( this.name, this.value );
// Serialize the form elements
jQuery.each( a, function(){
add( this.name, this.value );
@@
-517,7
+515,7
@@
jQuery.extend({
// Serialize the key/values
for ( var j in a )
// If the value is an array then the key names need to be repeated
// Serialize the key/values
for ( var j in a )
// If the value is an array then the key names need to be repeated
- if ( a[j] && a[j].constructor == Array )
+ if ( jQuery.isArray(a[j]) )
jQuery.each( a[j], function(){
add( j, this );
});
jQuery.each( a[j], function(){
add( j, this );
});