utils/dom/geteventroots
module
Functions
getEventRoots( node ) → Array<Document | ShadowRoot>module:utils/dom/geteventroots~getEventRootsReturns every event root of the given node: the shadow roots it renders in, innermost first, followed by the document it is connected to.
For code that listens to the DOM events of a node, which a listener on
documentalone may miss: events that are notcomposed, such asscroll, never leave the shadow root they started in, and the events that do are retargeted to the shadow host. Works for open and closed roots alike.Like
getShadowRoots, it reports the shadow roots of a detached node too. The document is only included while the node is connected to it. Empty fornull.Parameters
node: Node | nullThe node to collect the event roots of.
Returns
Array<Document | ShadowRoot>