Sign up (with export icon)

utils/dom/getparentelement

Api-module iconmodule

Functions

  • Chevron-right icon

    getParentElement( node ) → Element | null

    Returns the parent element of the given node, crossing shadow boundaries.

    The shadow-aware replacement for Node#parentElement, which is null for a node sitting directly in a ShadowRoot and so stops an outward walk at the boundary. Works for open and closed roots alike.

    Parameters

    node: Node

    The node to get the parent element of.

    Returns

    Element | null