Test name | Executions per second |
---|---|
querySelector | 2147756.0 Ops/sec |
querySelectorAll | 546866.3 Ops/sec |
getElementsByClassName | 4104457.0 Ops/sec |
querySelector (ID) | 2140440.2 Ops/sec |
getElementsByID | 4045557.5 Ops/sec |
<div class="test" id="test"></div>
document.querySelector(".test")
document.querySelectorAll(".test")
document.getElementsByClassName(".test")
document.querySelector("#test")
document.getElementById("test")