jQuery chaining (v6)

Revision 6 of this benchmark created by Eduardo on


Description

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

Preparation HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/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

Revisions

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