test_querySelector

Benchmark created by trinhle on


Preparation HTML

<!DOCTYPE html>
<html>
<body>
<div id='menu'>
  <div class='warning'>
    <a href="http://www.w3schools.com">
    This is a link</a>
     <div class='notice'>
     </div>
  </div>

  <div class='warning'>
    <a href="http://www.w3schools.com">
    This is a link</a>
     <div class='notice'>
     </div>
  </div>
</div>
</body>
</html>

Test runner

Ready to run.

Testing in
TestOps/sec
querySelectorAll
var errs = document.querySelectorAll('div.warning, div.notice');
ready
getElementsByTagName
var errs = [],
  divs = document.getElementsByTagName('div'), classname = '';
   for (var i = 0, len = divs.length; i < len; i++) {
     classname = divs[i].className;
      if (classname === 'notice' || classname === 'warning') {
         errs.push(divs[i]); }
    }
ready

Revisions

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

  • Revision 1: published by trinhle on