jQuery complex selector vs find vs context selector (v3)

Revision 3 of this benchmark created by N1 on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<div id="test1">
<dl>
<dt>Hi</dt>
<dd>There</dd>
</dl>
</div>

<div class="test2">
<dl><dt>Hi</dt>
<dd>There</dd>
</dl>
</div>

<div id="test3">
<dl>
<dt class="test3a">Hi</dt>
<dd class="test3b">There</dd></dl>
</div>

<div class="test4">
<dl>
<dt class="test4a">Hi</dt>
<dd class="test4b">There</dd>
</dl>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
complex
$("#test1 dt,#test1 dd");
ready
context (subset of id)
$("dt, dd", $("#test1"));
ready
find (subset of id)
$("#test1").find("dt, dd");
ready

Revisions

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