jQuery chaining (v20)

Revision 20 of this benchmark created on


Description

Tests whether chaining jQuery function calls is noticeably faster than separate calls.

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="theDiv">Some text</div>
<div class="div_holder">
<div class="div"></div>
<div class="div"></div>
<div class="div"></div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
first()
$('.div_holder').find('.div').first()
ready
[index]
$('.div_holder').find('.div')[0]
ready
traverse first()
$('.div_holder .div').first()
ready
Traverse [index]
$('.div_holder .div')[0]
ready

Revisions

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