qualifier vs find

JavaScript performance comparison

Test case created by Josh

Info

Why you should use find instead of qualifying your selector

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div class="c1">
  <div class="c1-2"></div>
  <div class="c1-3"></div>
  <div class="c1-1">
    <div class="c1-1-1">
       <div class="c1-1-1-1">Test</div>
    </div>
  </div>
</div>

Preparation code output

Test

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Find
$('.c1').find('.c1-1-1-1').text()
pending…
Qualifier
var parent = $('.c1');
var child = $('.c1-1-1-1', parent);
child.text();
pending…

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

Compare results of other browsers

0 comments

Add a comment