ant-design-vue/components/vc-util/Dom/contains.js

12 lines
178 B
JavaScript
Raw Normal View History

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