jQuery find child by class (v3)

Revision 3 of this benchmark created by mike on


Description

Compare find by different methods

Preparation HTML

<script src="http://code.jquery.com/jquery-1.6.min.js"></script>

<table id="test">
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td class="def">def</td><td>ghi</td><td>jkl</td></tr>
<tr><td>abc</td><td>def</td><td>ghi</td><td>jkl</td></tr>
</table

Test runner

Ready to run.

Testing in
TestOps/sec
pure query
$("#test td.def")
ready
find
$("#test").find("td.def")
ready
by context
$("td.def", document.getElementById("test"))
ready
by context 2
$("td.def", $("#test"))
ready
find by class only
$(".def")
ready

Revisions

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