Skip to content

Traverse up the DOM tree from a specified element.

License

Notifications You must be signed in to change notification settings

niftinessafoot/lineage

Repository files navigation

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 currentTarget elements are children of target parents.

usage

import (Lineage) from '@afoot/lineage';
const lineage = Lineage(document.querySelector('.foo'));
console.log(lineage); // Returns ['.foo','body']

license

MIT © Matthew Smith

made with ❤️ and ☕️ by

Niftiness Afoot! Matthew Smith