getElementById vs. querySelector (v143)

Revision 143 of this benchmark created by Kiura Magomadov on


Preparation HTML

<div id="conteiner">
  <p id="foo">Foo</p>
  <p id="bar">Bar</p>
  <p id="baz">Baz</p>
</div>

<scipt>
var conteiner = document.getElementById("conteiner");
</scipt>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
var bar = document.getElementById("bar");
ready
querySelector
var bar = conteiner.querySelector("#bar");
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.