jQuery addClass vs dom classList (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<div id="testDiv"></div>
  <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.