jQuery parents().hasClass() vs parentsUntil() (v14)

Revision 14 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div class="parent1">
  <div class="parent2">
  </div>
  <div class="parent2">
    <div class="parent3">
      <div class="parent4">
      </div>
      <div class="parent4">
        <div class="parent5">
          <div class="parent6">
            <div class="parent7">
            </div>
            <div class="parent7">
              <div class="parent8">
                <div class="parent9">
                  <div class="parent10">
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="parent3">
      </div>
    </div>
  </div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
parents and hasClass
jQuery('.parent9').parents().hasClass('parent3')
ready
parentsUntil
jQuery('.parent9').parentsUntil('.parent3')
ready

Revisions

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