12 lines
175 B
JavaScript
12 lines
175 B
JavaScript
|
export default function contains (root, n) {
|
||
|
let node = n
|
||
|
while (node) {
|
||
|
if (node === root) {
|
||
|
return true
|
||
|
}
|
||
|
node = node.parentNode
|
||
|
}
|
||
|
|
||
|
return false
|
||
|
}
|