mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
15 lines
433 B
JavaScript
15 lines
433 B
JavaScript
import { isShadowRoot } from "./predicates.js";
|
|
//#region src/dom/tree.ts
|
|
function containsComposed(root, element) {
|
|
let current = element;
|
|
while (current) {
|
|
if (current === root || root.contains(current)) return true;
|
|
const nodeRoot = current.getRootNode();
|
|
current = isShadowRoot(nodeRoot) ? nodeRoot.host : current.parentNode;
|
|
}
|
|
return false;
|
|
}
|
|
//#endregion
|
|
export { containsComposed };
|
|
|
|
//# sourceMappingURL=tree.js.map
|