Inline style vs CSS class (v18) Revision 18 of this benchmark created by Eric Wooley on March 31, 2015 Preparation HTML <style rel ='stylesheet' >
.foo { font-size: 13px; height: 90px; width:72.5px }
.bar { font-size: 45px; height: 100px, with:23.7px}
</style > Setup var foo = { 'font-size' : '13px' , height : '90px' , width :'72.5px' };
var bar = { 'font-size' : '45px' , height : '100px' , width :'23.7px' };
var node = document .createElement ('div' );
node.innerHTML = 'test Text' ;
document .body .appendChild (node);Teardown
document .body .removeChild (node);
Test runner Ready to run.
Run Quick Run Testing in Test Ops/sec Inline style color node.style ['font-size' ] = foo['font-size' ];
node.style .height = foo.height ;
node.style .width = foo.width ;
node.style ['font-size' ] = bar['font-size' ];
node.style .height = bar.height ;
node.style .width = bar.width ;
ready
CSS class node.className = 'foo' ;
node.className = 'bar' ;
ready
inline style object node.style = foo;
node.style = bar;
ready
Revisions You can edit these tests or add more tests to this page by appending /edit to the URL.
Revision 1 : published on September 27, 2013 Revision 2 : published by Sergey Ermakovich on September 30, 2013 Revision 3 : published on February 13, 2014 Revision 4 : published on April 30, 2014 Revision 5 : published on April 30, 2014 Revision 6 : published on May 22, 2014 Revision 7 : published by macwoj on June 11, 2014 Revision 8 : published by Jonas Gebhardt on July 18, 2014 Revision 9 : published on November 5, 2014 Revision 10 : published by Mike McKenzie on November 13, 2014 Revision 11 : published on December 5, 2014 Revision 12 : published on December 5, 2014 Revision 14 : published by carl sverre on February 14, 2015 Revision 16 : published on March 10, 2015 Revision 18 : published by Eric Wooley on March 31, 2015 Revision 19 : published by Eric Wooley on March 31, 2015 Revision 20 : published by Alec on September 13, 2015 Revision 21 : published on November 20, 2015 Revision 22 : published by Sergey Mamyan on December 12, 2015 Revision 23 : published by Inline style vs CSS class (more styles) on January 15, 2016