jquery selector speed (v50)

Revision 50 of this benchmark created by Ludwig on


Preparation HTML

<div class="container">
<div id="container">
    <ul>
        <li>1</li>
        <li id="target "class="target">2</li>
        <li>3</li>
    </ul>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
$('.container #target')
$('.container #target').css('border', '1px solid red');
ready
$('#target')
$('#target').css('border','1px solid red');
ready
$('.target')
$('.target').css('border','1px solid red');
ready

Revisions

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