Files
video-gen/video-gen-admin/node_modules/@rc-component/util/es/Dom/contains.js
T
2026-05-25 17:08:18 +08:00

20 lines
345 B
JavaScript

export default function contains(root, n) {
if (!root) {
return false;
}
// Use native if support
if (root.contains) {
return root.contains(n);
}
// `document.contains` not support with IE11
let node = n;
while (node) {
if (node === root) {
return true;
}
node = node.parentNode;
}
return false;
}