# utils/dom/getancestors

module

<a id="functions">

## Functions

<a id="function-getAncestors">

### `getAncestors( node ) → Array<Node>`

Returns all ancestors of given DOM node, starting from the top-most (root). Includes the given node itself. If the node is a part of `DocumentFragment` that `DocumentFragment` will be returned. In contrary, if the node is appended to a `Document`, that `Document` will not be returned (algorithms operating on DOM tree care for `Document#documentElement` at most, which will be returned).

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

#### Parameters

* `node: Node`

  DOM node.

#### Returns

* `Array<Node>`

  Array of given `node` parents.

---

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