@afoot/lineage
v0.1.4
Published
Traverse up the DOM tree from a specified element.
Downloads
32
Maintainers
Readme
lineage
Traverse up the DOM tree to a specific parent or all the way up to body. Returns an array of DOM nodes. Especially useful for event handling and verifying currentTaraget elements are children of target parents.
usage
import (Lineage) from '@afoot/lineage';
const lineage = Lineage(document.querySelector('.foo'));
console.log(lineage); // Returns ['.foo','body']