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 18_5_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/137.0.7151.51 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 137
Operating system:
iOS 18.5.0
Device Platform:
Mobile
Date tested:
one year ago
Class
12.1M/s
ID
11.4M/s
data attribute
10.3M/s
View exact numbers
Test name
Executions per second
✓
Class
12,127,292 Ops/sec
ID
11,409,159 Ops/sec
data attribute
10,270,250 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]');