Test name | Executions per second |
---|---|
querySelector | 8328613.5 Ops/sec |
querySelectorAll | 3555882.2 Ops/sec |
getElementsByClassName | 10607098.0 Ops/sec |
querySelector (ID) | 5925644.0 Ops/sec |
getElementsByID | 9688759.0 Ops/sec |
<div class="test" id="test"></div>
document.querySelector(".test")
document.querySelectorAll(".test")
document.getElementsByClassName(".test")
document.querySelector("#test")
document.getElementById("test")