Inline style vs CSS class (v10)

Revision 10 of this benchmark created by Mike McKenzie on


Preparation HTML

<style rel='stylesheet'>
  .test { color: #f66; background: #123;}
</style>

Setup

var node = document.createElement('div');
  var nodeStyle = node.style;

Teardown



            document.body.removeChild(node);
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
Inline style color
nodeStyle.color = '#f66';
nodeStyle.background = '#123';
document.body.appendChild(node);
ready
CSS class
node.className = 'test';
document.body.appendChild(node);
ready
cssText
nodeStyle.cssText = "color:#f66;background:#123;";
document.body.appendChild(node);
ready

Revisions

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