UNPKG

element-vir

Version:

Heroic. Reactive. Declarative. Type safe. Web components without compromise.

17 lines (16 loc) 543 B
import { DeclarativeElement } from './declarative-element.js'; export function hasDeclarativeElementParent(input) { const rootNode = input.getRootNode(); if (!(rootNode instanceof ShadowRoot)) { // declarative elements all use shadow DOM, so if a shadow root doesn't exist then we're not // in a declarative element. return false; } const host = rootNode.host; if (host instanceof DeclarativeElement) { return true; } else { return hasDeclarativeElementParent(host); } }