jquery - Which selector is faster? -


i'm searching existance of 1 matching selector. faster?

$('a[rel="something"]').first().length > 0) 

or

$('a[rel="something"]').length > 0) 

thanks!

$('a[rel="something"]').length > 0) should faster because not have overhead of picking (finding out) first() element in wrapped set $('a[rel="something"]').

and if targeting 1 element $('a[rel="something"]'), using first() isn't needed anyway.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -