UNPKG

svelte-motion

Version:

Svelte animation library based on the React library framer-motion.

26 lines (23 loc) 541 B
/** based on framer-motion@4.0.3, Copyright (c) 2018 Framer B.V. */ /** * Recursively traverse up the tree to check whether the provided child node * is the parent or a descendant of it. * * @param parent - Element to find * @param child - Element to test against parent */ var isNodeOrChild = function (parent, child) { if (!child) { return false; } else if (parent === child) { return true; } else { return isNodeOrChild(parent, child.parentElement); } }; export { isNodeOrChild };