jQuery: Child selector vs .find() (v16)

Revision 16 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div class="outerForm">
<div class="replyForm">
  <a href="#">Reply</a>
  <form class="whatever" action="" method="post">
    <input type="text" name="message" placeholder="" />
    <div class="formControls">
      <input type="submit" value="Send" name="sendButton" class="submit-widget button-field"
      />
    </div>
  </form>
</div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
.find()
$('.outerForm').find('.replyForm').find('a')
ready
Child selector
$('.replyForm > a')
ready
Children method
$('.replyForm').children('a')
ready
All Selectors then replyform test
$('.replyForm a')
ready
Find only
$('.replyForm').find('a')
ready

Revisions

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