getElementsByClassName VS querySelectorAll (v194)

Revision 194 of this benchmark created on


Preparation HTML

<div id="asd">
  <ul>
    <li><a href="#" name="name" class="classme">item 1</a></li>
  </ul>
  <ul>
    <li><a href="#" name="name" class="csname">item 1</a></li>
  </ul>
  <div>
    <ul>
      <li><a href="#" name="name" class="classname">item 1</a></li>
    </ul>
  </div>
</div>
<script>
  var nodes;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementsByClassName
var node = asd.getElementsByClassName('classname')[0];
ready
querySelectorAll
var node = asd.querySelector('.classname');
ready
jquery select
ready

Revisions

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