JQuery class selector test

Benchmark created by gertas on


Description

This test tries to answer question from StackOverflow: Most efficient way to use selectors in jQuery? http://stackoverflow.com/questions/4717032/most-efficient-way-to-use-selectors-in-jquery

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="test"> 
        <div class="testlink">
                <a href="#" id="linkone" title="test">test link</a>
        </div> 
        <div class="testmenu">
                <div>
                        <div class="menuitem itemone">
                                <a href="#" title="item 1">menu item 1</a>
                        </div>
                        <div class="menuitem itemtwo">
                                <a href="#" title="item 2">menu item 2</a>
                        </div >
                        <div class="menuitem itemthree active">
                                active item
                        </div>
                </div>
        </div>

Test runner

Ready to run.

Testing in
TestOps/sec
.active
$('.active')
ready
div.active
$('div.active')
ready

Revisions

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