react-portal-hoc
Version:
a hoc that portalizes components
15 lines (14 loc) • 447 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = targetIsDescendant;
function targetIsDescendant(target, parent) {
while (target !== document) {
// if the target hits null before it hits the document, that means
// its parent got unmounted, so assume it is (was) a descendant
if (target === parent || target === null) return true;
target = target.parentNode;
}
return false;
}
;