addClass

Benchmark created by David Condrey on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

z = document.body;

Test runner

Ready to run.

Testing in
TestOps/sec
add
document.body.classList.add("wait");
ready
cross
if (z.classList)
                        z.classList.add('wait');
                else
                        z.className += ' wait';
ready
jquery
$('body').addClass('wait');
ready
Concatenate
z.classList ? z.classList.add('wait') : z.className += ' wait';
ready

Revisions

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

  • Revision 1: published by David Condrey on