Reputation: 1669
Does the tag name hurt or help?
1) $content.find('[name=foo]')
or
2) $content.find('input[name=foo]')
Upvotes: 0
Views: 45
Reputation: 4022
I wrote a quick JSPerf test, it's actually almost the same.
Both are pretty slow (jQuery is quite slow anyway).
I tested the $.find() method two weeks ago. It's a good habit to use it, it's pretty efficient.
Upvotes: 1
Reputation: 68400
Before testing it, I'd say the second should perform better since it can take advantage of DOM method getElementsByTagName
. This is a first level filter that should improve a little the performance.
Probably it won't be noticiable unless the page is complex enough
Upvotes: 1