JQuery Tree Traversing (v2)

Revision 2 of this benchmark created on


Description

testing the traversing functions of the JQuery engine

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div>
<div>
<span>
<ul>
<li>This is the first item <a href="#">I am an anchor</a></li>
<li>This is a parent<div>I am a child</div><div>I am a sibling</div></li>
<li>I am a sibling</li>
</ul></span>
<div>I'm the next and closest div.</div>
</div>
<span>I'm a span</span>
<div>I'm the next div</div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
children()
$(function() {
 console.log($('li').children('div'));
})
ready
closest()
console.log($('li').closest('div'));
ready
find()
console.log($('li').find('div'));
ready
next()
console.log($('li').next('div'));
ready
nextAll()
console.log($('li').nextAll('div'));
ready
offsetParent()
console.log($('li').offsetParent('div'));
ready
parent()
console.log($('li').parent('div'));
ready
parentsUntil()
console.log($('li').parentsUntil('span');
ready
prev()
console.log($('div').prev('span'));
ready
prevAll()
console.log($('div').prevAll('span'));
ready
sibling()
console.log($('ul').sibling('div'));
ready

Revisions

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