Test name | Executions per second |
---|---|
querySelectorAll | 496223.0 Ops/sec |
getElementsByClassName | 1253973.0 Ops/sec |
<div class="test"></div>
document.querySelectorAll(".test").forEach(x=>x.style.color='red')
Array.from(document.getElementsByClassName(".test")).forEach(x=>x.style.color='red')