Is Previous the first-child?

Benchmark created by stecb on


Description

Check if previous element is first child

Preparation HTML

<div>
<ul>
  <li>First</li>
  <li id="second">Second</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
Using .is(':first-child')
$('#second').prev().is(':first-child');
ready
Using .index()
$('#second').prev().index();
ready

Revisions

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