Sign up (with export icon)

utils/dom/getparentnode

Api-module iconmodule

Functions

  • Chevron-right icon

    getParentNode( node ) → ParentNode | null

    Returns the node one step up the composed tree, crossing shadow boundaries.

    The shadow-aware replacement for Node#parentNode, and the primitive for walking from a node outwards to the document. It steps over any node, so such a walk visits the ShadowRoot nodes on the way and reaches the Document at the top – to walk elements only, use getParentElement. Works for open and closed roots alike.

    Parameters

    node: Node

    The node to step up from.

    Returns

    ParentNode | null