jQuery nested $(".class") selectors (v4)

Revision 4 of this benchmark created on


Description

Testing whether selecting multiple class names is faster by various methods

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<ul class="foo">
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li class="bar">
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
  <li>
    yay!
  </li>
</ul>

Test runner

Ready to run.

Testing in
TestOps/sec
.find()
$(".foo").find(".bar")
ready
context
$(".bar", ".foo")
ready
multiple classes in one $
$(".foo .bar")
ready
classes with tag names
$("ul.foo li.bar")
ready

Revisions

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