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
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- noderequiredNode
- The DOM node whose root to resolve. Works with element nodes, text nodes, and shadow-host descendants.
API
Return value
The value returned by this 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
Examples
Ready-to-paste usage snippets.
Check if an element is in the document