UNPKG

is-descendant

Version:

Checks if an element is descendant of another

18 lines (12 loc) 248 B
'use strict'; module.exports = isDescendant; function isDescendant(parent, child) { var node = child.parentNode; while (node !== null) { if (node === parent) { return true; } node = node.parentNode; } return false; }