jQuery 2 vs. document.querySelector (v21)

Revision 21 of this benchmark created on


Description

I know its been done before. Just want to see for myself - running jQuery 2

Preparation HTML

<div id="main">
  <ul class="gallery">
    <li id="firstli">
      Hello World
    </li>
    <li>
      Hello World
    </li>
    <li>
      Hello World
    </li>
    <li>
      Hello World
    </li>
    <li>
      Hello World
    </li>
    <li>
      Hello World
    </li>
  </ul>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

Teardown


    var el = document.querySelector("#main ul:first-child");
    el.style.display = "list-item";
  

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
$("#main ul:first-child").hide();
ready
DOM
var el = document.querySelector("#main ul:first-child");
el.style.display = "none";
ready

Revisions

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