jQuery chaining (v19)

Revision 19 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>

Test runner

Ready to run.

Testing in
TestOps/sec
Chained
$('#theDiv').addClass('test').removeClass('test');
ready
Separate calls
$('#theDiv').addClass('test');
$('#theDiv').removeClass('test');
ready
Separate calls (cached)
var d = $('#theDiv');
d.addClass('test');
d.removeClass('test');
ready
var d = $('#theDiv');
d.addClass('test').removeClass('test');
ready

Revisions

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