Test name | Executions per second |
---|---|
Contains | 4273268.5 Ops/sec |
Closest | 4389137.5 Ops/sec |
<div class="parent">
<div class="child">
</div>
</div>
var parent = document.querySelector(".parent");
var child = document.querySelector(".child");
var x = parent.contains(child)
var x = child.closest('.parent')