summaryrefslogtreecommitdiff
path: root/src/client/scripts/contains.ts
blob: 770bda63bb051ffb0c843d8873bf5818a6fb67f1 (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;
};