John,

If you say jQuery doesn't support the OR selector '|',  then I'm
confused. I have a form with one SELECT element and several INPUTs.
Check out the following results from Firebug:

>>> $('INPUT', $('#myform')).length
6
>>> $('INPUT|SELECT', $('#myform')).length
7

That's what I expected as a result.. can you explain?

m.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of John Resig
Sent: Wednesday, September 27, 2006 11:06 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Form plugin's serialize(): performance issues

Unfortunately, jQuery doesn't support the OR selector '|', otherwise
that'd work quite nicely. The problem is that I don't know how this
would work without using "*", and filtering away what you don't need -
while still keeping the order of all the elements that you want.

If anyone has any ideas, I'm all ears.

--John

On 9/27/06, Matt Grimm <[EMAIL PROTECTED]> wrote:
> I've run into a significant performance issue with the form plugin's 
> serialize method; not a bug per se, but definitely a show-stopper for 
> me. The problem is that I have a form with a select element, which has

> around 250 options. The serialize method grabs *all* child elements of

> the form before operating on any of them, like so:
>
> $('*', this).each( ... );
>
> This is awfully inefficient, especially considering each element type 
> is handled by name anyway in the following code. Perhaps it would be 
> best to define the top-level or containing elements first, then grab 
> just those (i.e., excluding OPTIONs):
>
> var elems = ['INPUT', 'SELECT', 'TEXTAREA', ...] $(elems.join('|'), 
> this).each( ... );
>
> So instead of looking through each OPTION for a selected property, the

> parent SELECT could be checked for its selectedIndex property. Any 
> thoughts?
>
> m.
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>


--
John Resig
http://ejohn.org/
[EMAIL PROTECTED]

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to