attachedRoot

Commons
stable

Return the root node (HTMLDocument or ShadowRoot) of a DOM node if it is attached to the live document, or null if it is detached. Shadow DOM aware.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

node
requis
Node
The DOM node whose root to resolve. Works with element nodes, text nodes, and shadow-host descendants.

API

Valeur de retour

La valeur retournée par cet util.

The composed root node when the element is attached to the document, or null when it is detached or outside the live tree.

Usage

Exemples

Extraits de code prêts à coller.

Check if an element is in the document

typescript