2020-01-29 11:37:25 -08:00
|
|
|
export default (parent, child, checkSame = true) => {
|
|
|
|
if (checkSame && parent === child) return true;
|
2017-02-20 03:13:42 -08:00
|
|
|
let node = child.parentNode;
|
|
|
|
while (node) {
|
2022-05-06 22:19:15 -07:00
|
|
|
if (node === parent) return true;
|
2017-02-20 03:13:42 -08:00
|
|
|
node = node.parentNode;
|
|
|
|
}
|
|
|
|
return false;
|
2017-03-18 04:05:11 -07:00
|
|
|
};
|