Selecting the first (v8)

Revision 8 of this benchmark created on


Preparation HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<div>
        <ul>
        <li class="answer">Foo</li>
        <li class="answer">Bar</li>
        <li class="answer">Moo</li>
        <li class="answer">Cat</li>
        <ul>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
first() method
$('.answer').first();
ready
:first sizzle
$('.answer:first');
ready
.eq(0) method
$('.answer').eq(0);
ready
:eq(0) sizzle
$('.answer:eq(0)');
ready
$($(".answer")[0]) nested jQuery object
$($(".answer")[0]);
ready

Revisions

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