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

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -