setAttribute('class') vs className (v5)

Revision 5 of this benchmark created on


Setup

var myDiv = document.createElement('div');

Teardown


    myDiv.setAttribute('class', ''); // Reset
  

Test runner

Ready to run.

Testing in
TestOps/sec
setAttribute
myDiv.setAttribute('class', 'myClass');
ready
className prop
myDiv.className = 'myClass';
ready

Revisions

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