Test name | Executions per second |
---|---|
querySelector | 3238369.8 Ops/sec |
querySelectorAll | 1371041.2 Ops/sec |
getElementsByClassName | 5261427.0 Ops/sec |
querySelector (ID) | 3275170.8 Ops/sec |
getElementsByID | 5426721.5 Ops/sec |
<div class="test" id="test"></div>
document.querySelector(".test")
document.querySelectorAll(".test")
document.getElementsByClassName(".test")
document.querySelector("#test")
document.getElementById("test")