jquery 1.10.2 selectors

JavaScript performance comparison

Revision 48 of this test case created

Preparation code

<div id="test"> 
        <div class="testlink">
                <a href="#" id="linkone" title="test">test link</a>
        </div>
        <div class="testmenu">
                <ul>
                        <li class="menuitem itemone">
                                <a href="#" title="item 1">menu item 1</a>
                        </li>
                        <li class="menuitem itemtwo">
                                <a href="#" title="item 2">menu item 2</a>
                        </li>
                        <li class="menuitem itemthree">
                                not clickable item 3
                        </li>
                </ul>
        </div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script> var $jq102 = jQuery.noConflict( true ); </script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
by id
$jq102('#linkone');
pending…
by class
$jq102('.menuitem');
pending…
by tag-class
$jq102('li.menuitem');
pending…
by attr
$jq102('a[title="test"]');
pending…
with regex
$jq102('a[title*="item"]')
pending…
nth-child(even)
$jq102('li:nth-child(even)');
pending…
li:last-child
$jq102('li:last-child');
pending…
unquoted attr with simpler regex
$jq102('div[class^=test]');
pending…
unquoted attr check
$jq102('div[title=test]');
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. Here’s a list of current revisions for this page:

0 comments

Add a comment