Child selector?

JavaScript performance comparison

Test case created by Brad Graham

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="feature">
<div id="panels>
<div class="article"><p>First</p></div>
<div class="article"><p>Second</p></div>
<div class="article"><p>Third</p></div>
</div>
</div>
<script>
  var $feature = $('#feature');
  var $panels = $('#panels')
</script>
    

Preparation code output

<div id="feature"> <div id="panels> <div class="article"><p>First</p></div> <div class="article"><p>Second</p></div> <div class="article"><p>Third</p></div> </div> </div>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
$feature.find
$feature.find('div.article').attr({
 'aria-hidden': 'true'
});
pending…
$feature.find child
$feature.find('#panels > div.article').attr({
 'aria-hidden': 'true'
});
pending…
$panels.find
$panels.find('div.article').attr({
 'aria-hidden': 'true'
});
pending…

Compare results of other browsers

Revisions

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

0 Comments

First

Second

Third