Jörn,
I see negligible performance gains using $(:input, ctx) vs the current
$('*:not(option)', ctx), however it does make the code cleaner because
I can get rid of the 'ok' array.
formToArray now looks like this:
jQuery.fn.formToArray = function(semantic) {
var a = [];
var q = semantic ? ':input' : 'input,textarea,select,button';
jQuery(q, this).each(function() {
var n = this.name;
var t = this.type;
if ( !n || this.disabled || t == 'reset' ||
(t == 'checkbox' || t == 'radio') && !this.checked ||
(t == 'submit' || t == 'image' || t == 'button') &&
this.form && this.form.clk != this ||
this.tagName.toLowerCase() == 'select' && this.selectedIndex == -1)
return;
if (t == 'image' && this.form.clk_x != undefined)
return a.push(
{name: n+'_x', value: this.form.clk_x},
{name: n+'_y', value: this.form.clk_y}
);
if (t == 'select-multiple') {
jQuery('option:selected', this).each( function() {
a.push({name: n, value: this.value});
});
return;
}
a.push({name: n, value: this.value});
});
return a;
};
_______________________________________________
jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/