jQuery 1 vs jQuery 2 (v15)

Revision 15 of this benchmark created on


Preparation HTML

<script src="https://code.jquery.com/jquery-git1.js"></script>
<script src="https://code.jquery.com/jquery-git2.js"></script>
<script>
  var jQ1 = jQuery.noConflict();
</script>
<script>
  var jQ2 = jQuery.noConflict();
</script>
<div id="idSelector">
</div>
<div class="classSelector">
</div>
<ul id="iteration">
  <li>
  </li>
  <li>
  </li>
  <li>
  </li>
  <li>
  </li>
  <li>
  </li>
  <li>
  </li>
  <li>
  </li>
</ul>
<div id="cssGetter" style="color: black;">
</div>
<div id="cssSetter" style="color: black;">
</div>
<div id="find">
  <span>
  </span>
  <div>
    <strong>
    </strong>
  </div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
1 ID Selector
jQ1("#idSelector");
ready
2 ID Selector
jQ2("#idSelector");
ready
1 Class Selector
jQ1(".classSelector");
ready
2 Class Selector
jQ2(".classSelector");
ready
1 Iteration
jQ1("#iteration li").each(function(i, e) {
  i++;
});
ready
2 Iteration
jQ2("#iteration li").each(function(i, e) {
  i++;
});
ready
1 CSS Getter
jQ1("#cssGetter").css("color");
ready
2 CSS Getter
jQ2("#cssGetter").css("color");
ready
1 CSS Setter
jQ1("#cssSetter").css("color", "red");
ready
2 CSS Setter
jQ2("#cssSetter").css("color", "red");
ready
1 Find
jQ1("#find").find("strong");
ready
2 Find
jQ2("#find").find("strong");
ready
1 Non-existent ID
jQ1("#someID");
ready
2 Non-existent ID
jQ2("#someID");
ready
1 Non-existent Class
jQ1(".someClass");
ready
2 Non-existent Class
jQ2(".someClass");
ready
1 Filter-next-prev
jQ1("#iteration li").filter(":first").next();
jQ1("#iteration li").filter(":last").prev();
ready
2 Filter-next-prev
jQ2("#iteration li").filter(":first").next();
jQ2("#iteration li").filter(":last").prev();
ready

Revisions

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