Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 34x 40x 3x 37x 19x 18x | /** * 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 */ export const isNodeOrChild = ( parent: Element, child?: Element | null ): boolean => { if (!child) { return false } else if (parent === child) { return true } else { return isNodeOrChild(parent, child.parentElement) } } |