jQuery addClass vs dom classList (v2)

Revision 2 of this benchmark created by c9s on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/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
document.getElementById("testDiv").classList.add("class1");
ready

Revisions

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