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
classList add
11.2M/s
styling
4.2M/s
csstext
688K/s
View exact numbers
Test name
Executions per second
✓
classList add
11,162,162 Ops/sec
styling
4,187,561 Ops/sec
csstext
688,349 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')