Style Element

JavaScript performance comparison

Test case created

Info

Check if adding <Style /> element will affect performance.

Preparation code

<div id='box' style="width:200px; height:200px; border:1px solid Red;"></div>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Add style element
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.cssClass { color: #F00; background-color:Blue;box-sizing:border-box;}';
document.getElementsByTagName('head')[0].appendChild(style);
document.getElementById('box').className = 'cssClass';
pending…
Add style element2
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.cssClass { color: #F00; background-color:Blue;}';

document.getElementsByTagName('head')[0].appendChild(style);
document.getElementById('box').className = 'cssClass';
pending…

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

Compare results of other browsers

0 comments

Add a comment