Is document.links faster in finding a link using jQuery?

Posted by vsync on Stack Overflow See other posts from Stack Overflow or by vsync
Published on 2010-04-01T11:49:51Z Indexed on 2010/04/01 11:53 UTC
Read the original article Hit count: 291

Filed under:
|
|

Is this faster:

$(document.links).filter('a.someClass')

than just plain old this:

$('a.someClass')

?

I don't see anywhere in jQuery's code the utilization of document.links
which gives you the collection of links on the document right away,
than, it would seem, it would be faster to just filter in the collection
instead of all the DOM nodes, which is alot more nodes to go over.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery