jquery 'best practice' in regard to class selectors is to prefix them with tag name whenever possible. i am not sure if using parent-child selectors speeds up the code execution even more, but i imagine it could.
Azadi Saryev On 14/11/2009 04:51, Andy Matthews wrote: > Josh... > > That's not true. Everything I've read says that the less specific you are, > the faster your code will run. > > In your example, it has to search through a whole bunch of stuff rather than > just going and finding items with a class of oldUsers. > > > > andy > > -----Original Message----- > From: Josh Nathanson [mailto:[email protected]] > Sent: Friday, November 13, 2009 12:20 PM > To: cf-talk > Subject: RE: 'Tis a sad, sad day...jQuery kills FireFox but works great in > IE! > > > You might get a tad bit more speed if you do this in your selectors: > > $("table.stripe>tbody>tr.oldUsers") > > Instead of this: > > $(".oldUsers") > > This is because jQuery will execute the DOM search more specifically instead > of having to traverse the whole DOM for that class. > > -- Josh > > > > -----Original Message----- > From: Eric Cobb [mailto:[email protected]] > Sent: Friday, November 13, 2009 6:26 AM > To: cf-talk > Subject: Re: 'Tis a sad, sad day...jQuery kills FireFox but works great in > IE! > > > Yeah, after tinkering with it a little more I realized what I was trying > to do would be better with classes instead of IDs. I really didn't want > to have to deal with a unique ID for all 500 rows. > > Anyway, here's my jQuery now: > > $("#userFilter").click(function(){ > // If checked > if ($("#userFilter").is(":checked")){ > //hide all old users > $(".oldUsers").css("display","none"); > } > else { > //show all old users > $(".oldUsers").css("display","table-row"); > } > }); > > It works correctly in both FF and IE, although in FF there's still a > good bit of lag time from when you click the checkbox until it actually > hides the rows. I guess it's just the way FF is dealing with so many > table rows. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328390 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

