parents.find vs parents().parents()
JavaScript performance comparison
Preparation code
<div class="control-group">
<div class="controls radio-other">
<label class="radio"><input type="radio" name="enq002" id="enq002" value="enq002-opt">Ja</label>
<label class="radio"><input type="radio" name="enq002" id="enq003" value="enq003-opt">Nee</label>
<label class="radio"><input type="radio" name="enq002" id="enq004" value="enq004-opt" data-linktype="toggle" data-target="#enq005"> Anders, namelijk...</label>
<input type="text" placeholder="Alternatief antwoord" id="enq005" class="hide other">
</div>
</div><script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Parent().parent().find() |
|
pending… |
parents.find() |
|
pending… |
Parents('elemtent').find() |
|
pending… |
parentsUntil('emelemt').find() |
|
pending… |
parents('element').closest() |
|
pending… |
parentsUntil('element').closest() |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments