2019-01-12 03:33:27 +00:00
|
|
|
export default function contains(root, n) {
|
|
|
|
let node = n;
|
2017-12-22 10:43:28 +00:00
|
|
|
while (node) {
|
|
|
|
if (node === root) {
|
2019-01-12 03:33:27 +00:00
|
|
|
return true;
|
2017-12-22 10:43:28 +00:00
|
|
|
}
|
2019-01-12 03:33:27 +00:00
|
|
|
node = node.parentNode;
|
2017-12-22 10:43:28 +00:00
|
|
|
}
|
|
|
|
|
2019-01-12 03:33:27 +00:00
|
|
|
return false;
|
2017-12-22 10:43:28 +00:00
|
|
|
}
|