jQuery .find() vs. context selector vs non-context selector (v148)

Revision 148 of this benchmark created by a on


Preparation HTML

<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

<article id="article">
	<p>A test</p>
	<p><ins></ins></p>
	<p>This is text</p>
</article>

Setup

var $article = $('#article');

Test runner

Ready to run.

Testing in
TestOps/sec
a
var has = $('ins',$article).length > 0 ? true : false;
ready
b
var has = $article.find('ins').length > 0 ? true : false;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.