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 currentTarget
elements are children of target
parents.
import (Lineage) from '@afoot/lineage';
const lineage = Lineage(document.querySelector('.foo'));
console.log(lineage); // Returns ['.foo','body']