On Jan 5, 6:46 am, Andraž Kos <[email protected]> wrote:
> Hello,
>
> I would like your opinion on which one is better practice (example in
> jQuery code) for fast executing code:
>
> $('#x tr.zebra').removeClass('zebra');
>
> vs
>
> $('#x tr').removeClass('zebra');
>
> First one will select only targeted items, then run the remove function
> only where needed.
> Second one will select all possible targets without taking time to filter
> them, then run the code on each one.
>
> Which one would you use more often and reasons why?
>
Neither. Add a class to the table or tbody and a couple selectors to
the stylesheet.

As explained in "change style value for several elements".

And here (if it's up):-
http://jibbering.com/faq/notes/code-guidelines/#design
Under "Loops" links to:

http://jibbering.com/faq/notes/code-guidelines/descendant-sel.html

BTW - anyone fork make a github page of that FAQ.
--
Garrett
twitter: @xkit
personx.tumblr.com

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to