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.

-- 

Thanks,

Eric Cobb
http://www.cfgears.com



Peter Boughton wrote:
>> I have a (large) table that has a list of 
>> users with IDs of "newUsers" and "oldUsers".
>>     
>
> This is wrong!
>
> Every ID on the page *must* be unique.
>
> Use CLASS for common attributes. 
>
> 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:328375
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to