className vs addClass,removeClass (v7)

Revision 7 of this benchmark created by bin on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<style>
    .nor .left{}
    .nor .right{}
    .nor .center{}
    .foc .left{}
    .foc .right{}
    .foc .center{}
</style>
<div id = "container" class="nor">
    <div id="left" class="left"></div>
    <div id="center" class="center"></div>
    <div id="right" class="right"></div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
addClass
$("#container").attr("class","foc");
 
ready
attr class
$("#container").removeClass("nor").addClass("foc")
ready

Revisions

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