referencing tag#id vs. just #id in jQuery

Eli Cochran eli at media.berkeley.edu
Fri Jan 11 22:21:05 UTC 2008


Hi,
Debugging in the Reorder, I noticed that the container reference is  
"div#page-replace:qdLafeWr4uLjjkNvwiyDshYm:gallery::thumbs- 
panel::gallery-thumbs::lightbox-temp-container::.image-container"

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.

This might have been something that was improved in subsequent  
versions of jQuery. I'll try to find out.

- Eli
. . . . . . . . . . .  .  .   .    .      .         .              .     
                  .

Eli Cochran
user interaction developer
ETS, UC Berkeley


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


More information about the fluid-work mailing list