Sign up (with export icon)

utils/dom/isshadowhostof

Api-module iconmodule

Functions

  • Chevron-right icon

    isShadowHostOf( node, shadowRoots ) → boolean

    Checks whether the given node is the host of any of the given shadow roots.

    Answers "is this a stand-in for something inside one of these roots, rather than the real thing?". A DOM API that cannot reach into a shadow tree reports its host in place of the node inside it – most commonly an event target, retargeted for a listener that does not live in that tree. Works for open and closed roots alike.

    Parameters

    node: EventTarget | null

    The node to test.

    shadowRoots: Iterable<ShadowRoot>

    The shadow roots to test against.

    Returns

    boolean