selectorComparision

Benchmark created on


Preparation HTML

<div class="test" data-selector="test"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
selectByClass
document.querySelectorAll('.test')
ready
selectByDataAttr
document.querySelectorAll('[data-selector]')
ready
selectByDataAttrWithClass
document.querySelectorAll('.test[data-selector]')
ready
selectByDataAttrWithClassReversed
document.querySelectorAll('[data-selector].test')
ready
selectByDataAttrWithValue
document.querySelectorAll('[data-selector="test"]')
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.