referencing tag#id vs. just #id in jQuery

Anastasia Cheetham a.cheetham at utoronto.ca
Mon Jan 14 15:07:18 UTC 2008


On Jan 11, 2008, at 5:21 PM, Eli Cochran wrote:

> I just read a comment in the jQuery forum which says that, as of  
> last July, referencing just the id with out the tag reference is  
> significantly faster eg. jQuery('#foo') not jQuery('div#foo') . The  
> commenter said that when you reference an id with the tag reference  
> jQuery ends up looping through every element to check for the id  
> instead of using getElementById.


Eli, thanks for pointing this out. We'll definitely have a second  
look at the code, and see if the tag is truly necessary.

-- 
Anastasia Cheetham                   a.cheetham at utoronto.ca
Software Designer, Fluid Project
Adaptive Technology Resource Centre / University of Toronto

    "Sometimes I think we're alone. Sometimes I think we're
     not. In either case, the thought is staggering."
                                   -- R. Buckminster Fuller



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://fluidproject.org/pipermail/fluid-work/attachments/20080114/4be402d4/attachment.html>


More information about the fluid-work mailing list