jquery 1.11.1 selectors

JavaScript performance comparison

Revision 53 of this test case created by

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="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script> var $jq1111 = jQuery.noConflict( true ); </script>
    

Preparation code output

<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>

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
by id
$jq1111('#linkone');
pending…
by class
$jq1111('.menuitem');
pending…
by tag-class
$jq1111('li.menuitem');
pending…
by attr
$jq1111('a[title="test"]');
pending…
with regex
$jq1111('a[title*="item"]')
pending…
nth-child(even)
$jq1111('li:nth-child(even)');
pending…
li:last-child
$jq1111('li:last-child');
pending…
unquoted attr with simpler regex
$jq1111('div[class^=test]');
pending…
unquoted attr check
$jq1111('div[title=test]');
pending…
by id and class
$jq1111('#test .menuitem');
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