ClassList versus ClassName (v3)

Revision 3 of this benchmark created by Marcin on


Preparation HTML

<div id="foo"
></div>
<script>
 fooEl = document.getElementById('foo');
</script><script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

fooEl.className = '';

Test runner

Ready to run.

Testing in
TestOps/sec
Class List
fooEl.classList.add('bbbb');    // duplicate
ready
Raw Class Name
fooEl.className = 'bbbb';
ready

Revisions

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