Test name | Executions per second |
---|---|
querySelector | 7412254.5 Ops/sec |
querySelectorAll | 3585958.8 Ops/sec |
getElementsByClassName | 9673913.0 Ops/sec |
querySelector (ID) | 5619533.5 Ops/sec |
getElementsByID | 10606242.0 Ops/sec |
<div class="test" id="test"></div>
document.querySelector(".test")
document.querySelectorAll(".test")
document.getElementsByClassName(".test")
document.querySelector("#test")
document.getElementById("test")