jQuery parent/child (v79)

Revision 79 of this benchmark created by Tarran Jones on


Description

Selecting parent>child (context, pure selector, jquery traversal combinations.

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div>
  <ul id="list">
    <li class="test">
    </li>
    <li>
    </li>
    <li class="test">
    </li>
    <li class="test">
    </li>
    <li>
    </li>
    <li class="test">
    </li>
    <li>
    </li>
    <li class="test">
    </li>
    <li>
    </li>
    <li class="test">
    </li>
  </ul>
</div>
<div class="test">
</div>
<script>
  var list = document.getElementById('list');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
selector
var $test = $('#list>.test');
ready
selector, context
var $test = $('>.test', list);
ready
context and find()
var $test = $(list).find('>.test');
ready
context and find() and parent(context)
var $test = $(list).find('.test').parent(list);
ready
selector and find
var $test = $('#list').find('>.test');
ready
selector and find and parent(selector)
var $test = $('#list').find('.test').parent('#list');
 
ready
context children
$test = $(list).children('.test');
ready
selector children
$test = $('#list').children('.test');
ready

Revisions

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