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_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/130.0.6723.90 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 130
Operating system:
iOS 18.1
Device Platform:
Mobile
Date tested:
one year ago
data attribute
5.5M/s
Class
5.5M/s
ID
5.1M/s
View exact numbers
Test name
Executions per second
✓
data attribute
5,508,000 Ops/sec
Class
5,462,728 Ops/sec
ID
5,129,163 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]');