jQuery addClass vs dom classList (v27)

Revision 27 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>
<div id="testDiv">
  <style>
    .class1{ color: red }
  </style>

Test runner

Ready to run.

Testing in
TestOps/sec
jquery addClass
$("#testDiv").addClass("class1");
ready
dom classList
$("#testDiv")[0].classList.add("class1");
ready

Revisions

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