Browser Diet - jQuery Selectors (v35)

Revision 35 of this benchmark created on


Preparation HTML

<div>
  <ul id="list">
    <li class="test"></li>
    <li></li>
    <li class="test"></li>
    <li>
      <span class="txt">text</span>
    </li>
    <li class="test"></li>
    <li></li>
    <li class="test"></li>
    <li></li>
    <li class="test"></li>
  </ul>
</div>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<script>
  var list = document.getElementById('list');
  var $list = $('#list');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
context
var $test = $('.txt', $list);
ready
selector
var $test = $('#list .txt');
ready
context and find()
var $test = $list.find('.txt');
ready
selector with context
var $test = $('.txt', '#list');
ready
direct selector
var $test = $('.txt');
ready

Revisions

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