jQuery .find() vs descendant selector (v46)

Revision 46 of this benchmark created on


Preparation HTML

<script src="https://code.jquery.com/jquery-2.0.3.min.js"></script>
<div>
<div id="container">
<div></div>
<div></div>
<div class="robotarm"></div>
<div><div class="robotarm"></div></div>
<div class="robotarm"></div>
<div class="robotarm"></div>
<div></div>
</div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
Descendant Selector
$('#container div.robotarm');
$('#container div.robotarm');
$('#container div.robotarm');
$('#container div.robotarm');
$('#container div.robotarm');
ready
Find / reuse
var $container = $('#container');
$container.find('div.robotarm');
$container.find('div.robotarm');
$container.find('div.robotarm');
$container.find('div.robotarm');
$container.find('div.robotarm');
ready
Variable selector
var roboVar = 'robotarm';
$('#container div.' + roboVar);
$('#container div.' + roboVar);
$('#container div.' + roboVar);
$('#container div.' + roboVar);
$('#container div.' + roboVar);
ready

Revisions

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