ClassList versus ClassName (v12)

Revision 12 of this benchmark created 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 = 'aaaa bbbb cccc dddd';
  jFooEl = jQuery(fooEl);

Test runner

Ready to run.

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

Revisions

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