Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
js css - style.cssText vs style vs setAttribute
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 17
Operating system:
iOS 17.5.1
Device Platform:
Mobile
Date tested:
7 months ago
Test name
Executions per second
style.cssText
666207.4 Ops/sec
style
434795.9 Ops/sec
setAttribute
27106326.0 Ops/sec
HTML Preparation code:
<div id="test"></div>
Script Preparation code:
el = document.getElementById("test");
Tests:
style.cssText
el.style.cssText = "color:red;border:1vmin solid red;padding:0.5vmin;background-color:black;height:1vh;width:1vw;";
style
el.style.height = '1vh'; el.style.width = '1vw'; el.style.color = 'red'; el.style.border = '1vmin solid red'; el.style.backgroundColor = 'black'; el.style.padding = '0.5vmin';
setAttribute
el.setAttribute('style',"color:red;border:1vmin solid red;padding:0.5vmin;background-color:black;height:1vh;width:1vw;");