jQuery vs. document.querySelector (v47)

Revision 47 of this benchmark created on


Description

I know its been done before. Just want to see for myself

Preparation HTML

<div id="main">
  <ul class="gallery">
    <li class='one'>
      Hello World
    </li>
    <li class='two'>
      Hello World
    </li>
    <li class='three'>
      Hello World
    </li>
    <li class='four'>
      Hello World
    </li>
    <li class='five'>
      Hello World
    </li>
    <li class='six'>
      Hello World
    </li>
  </ul>
</div>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery el.className
var el = $("li.six");
ready
jQuery className
var el = $(".six");
ready
DOM el.className
var el = document.querySelector('li.six');
ready
DOM className
var el = document.querySelector('.six');
ready

Revisions

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