Test name | Executions per second |
---|---|
querySelector | 883383.3 Ops/sec |
querySelectorAll | 393156.3 Ops/sec |
getElementsByClassName | 1070177.1 Ops/sec |
querySelector (ID) | 722189.2 Ops/sec |
getElementsByID | 1123352.2 Ops/sec |
<div class="test" id="test"></div>
document.querySelector(".test")
document.querySelectorAll(".test")
document.getElementsByClassName(".test")
document.querySelector("#test")
document.getElementById("test")