# utils/dom/geteventroots

module

<a id="functions"></a>

## Functions

<a id="function-getEventRoots"></a>

### `getEventRoots( node ) → Array<Document | ShadowRoot>`

Returns 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 `document` alone may miss: events that are not `composed`, such as `scroll`, 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`](module_utils_dom_getshadowroots.md#function-getShadowRoots), it reports the shadow roots of a detached node too. The document is only included while the node is connected to it. Empty for `null`.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/dom/geteventroots.ts#L25)

#### Parameters

* `node: Node | null`

  The node to collect the event roots of.

#### Returns

* `Array<Document | ShadowRoot>`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
