Test name | Executions per second |
---|---|
querySelectorAll | 1463889.0 Ops/sec |
getElementsByClassName | 3664026.8 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')