Skip to main content

@microsoft/fast-foundation > composedParent

composedParent() function

Retrieves the "composed parent" element of a node, ignoring DOM tree boundaries. When the parent of a node is a shadow-root, it will return the host element of the shadow root. Otherwise it will return the parent node or null if no parent node exists.

Signature:
export declare function composedParent<T extends HTMLElement>(element: T): HTMLElement | null;

Parameters

ParameterTypeDescription
elementTThe element for which to retrieve the composed parent
Returns:

HTMLElement | null