X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=inline;f=src%2Fajax.js;h=7e024a319732d41f18cfa79b27d29ac10f67a2c7;hb=464535e0965d5de617a24e608a2d05393194c3fd;hp=bda79b50aa9d1887f52b9a3eca33f4796147bcef;hpb=c9c024280abd20b4eef4a2dc280fa7f1d7be02f9;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index bda79b5..7e024a3 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -66,8 +66,7 @@ jQuery.fn.extend({ }, 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 && @@ -77,7 +76,7 @@ jQuery.fn.extend({ .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}; }) : @@ -505,7 +504,7 @@ jQuery.extend({ // 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 ); @@ -516,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 - if ( a[j] && a[j].constructor == Array ) + if ( jQuery.isArray(a[j]) ) jQuery.each( a[j], function(){ add( j, this ); });