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