Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
CssText vs Styling vs classList add
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 18
Operating system:
iOS 18.3
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
csstext
688349.1 Ops/sec
styling
4187560.8 Ops/sec
classList add
11162162.0 Ops/sec
HTML Preparation code:
<div id="myid">hi</div> <style> .wide { width: 100px; } .long { left: 100px; height: 100px; } .blue { top: 100px; } </style>
Script Preparation code:
var a = document.getElementById("myid"); a.style.position = "absolute";
Tests:
csstext
a.style.cssText += "left: 100px ;top: 100px; width: 100px; height: 100px";
styling
a.style.left = "100px" a.style.top = "100px" a.style.width = "100px" a.style.height = "100px"
classList add
a.classList.add('wide','long','blue')