jquery selector speed (v5)

Revision 5 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
$('div#container ul li.target')
var a = $('div#container ul li.target');
ready
$('#container .target')
var b = $('#container .target');
ready
$('li.target')
var c = $('li.target');
ready
$('.target')
var d = $('.target');
ready
$('div#container>ul>li.target')
var e = $('div#container>ul>li.target');
ready

Revisions

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