Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
DataAttribute vs Class Selector vs ID Selector
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/124.0.6367.88 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 124
Operating system:
iOS 17.4
Device Platform:
Mobile
Date tested:
2 years ago
Class
5.9M/s
ID
4.8M/s
data attribute
3.9M/s
View exact numbers
Test name
Executions per second
✓
Class
5,853,664 Ops/sec
ID
4,836,582 Ops/sec
data attribute
3,895,721 Ops/sec
HTML Preparation code:
<div class="hello" id="hello" data-hello>Hello</div>
Tests:
Class
document.querySelector('.hello');
ID
document.querySelector('#hello');
data attribute
document.querySelector('[data-hello]');