summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts/contains.ts
blob: 256e09d2937c0beb7424c712ca8350d1a5529a99 (plain)
1
2
3
4
5
6
7
8
9
export default (parent, child, checkSame = true) => {
	if (checkSame && parent === child) return true;
	let node = child.parentNode;
	while (node) {
		if (node === parent) return true;
		node = node.parentNode;
	}
	return false;
};