# utils/dom/getrangefrommouseevent

module

<a id="functions">

## Functions

<a id="function-getRangeFromMouseEvent">

### `getRangeFromMouseEvent( domEvent ) → Range | null`

Returns a DOM range from a given point specified by a mouse event.

**Note**: The point is resolved inside the shadow root the event was dispatched in, so a click inside a shadow tree gives a range in that tree rather than one at its host. Works for open and closed shadow roots alike, on the engines that honor the `shadowRoots` option of `Document#caretPositionFromPoint()`; elsewhere the range still lands beside the host.

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

#### Parameters

* `domEvent: MouseEvent & object`

  The mouse event.

#### Returns

* `Range | null`

  The DOM range.

---

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