I think Jake probably forgot to include a space in the replacement
string:
> temp.replace(" zebra ", "");
or included one too many in the search string. Otherwise, the classes
"one zebra two" would become "onetwo" which is a new class altogether.Also, the trim method is not a default, so you'll need to extend the string prototype to include that, or use a different solution. On Jan 6, 11:56 am, Jake Verbaten <[email protected]> wrote: > If you want real performance don't use jQuery (which is an order of > magnitude slower on average) > > var nodes = document.getElementById("x").getElementsByClassName("zebra"); > > for (var i = 0, len = nodes.length; i < len; i++) { > var node = nodes[i]; > if (node.tagName !== "TR") continue; > var temp = (" " + node.className + " "); > temp.replace(" zebra ", ""); > node.className = temp.trim(); > > > > > > > > } > On Fri, Jan 6, 2012 at 2:13 PM, JCM <[email protected]> wrote: > > If you want perfomance: > > $('#x').find('tr.zebra').removeClass('zebra'); > > > -- > > 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] -- 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]
