jQuery chaining

Benchmark created on


Preparation HTML

<script src="https://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

Revisions

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