Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
DataAttribute vs Class Selector vs ID Selector vs Custom Attributes
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0
Browser:
Firefox 146
Operating system:
Windows
Device Platform:
Desktop
Date tested:
7 months ago
Benchmark engine:
Benchmark.js
id
4.7M/s
data attribute
4.6M/s
class
4.6M/s
uid
4.3M/s
View exact numbers
Test name
Executions per second
✓
id
4,707,752 Ops/sec
data attribute
4,646,132 Ops/sec
class
4,645,091 Ops/sec
uid
4,329,929 Ops/sec
HTML Preparation code:
<div class="hello" id="hello" data-hello uid="hello">Hello</div>
Tests:
data attribute
document.querySelector('[data-hello]');
class
document.querySelector('.hello');
id
document.querySelector('#hello');
uid
document.querySelector('[uid="hello"]');