---
title: "tinymce.dom.RangeUtils"
description: "This class contains a few utility methods for ranges."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.dom.rangeutils/"
md_url: "https://www.tiny.cloud/docs/tinymce/5/apis/tinymce.dom.rangeutils/index.md"
version: "5"
last_updated: "2024-03-26T08:09:19Z"
tokens: 338
---
Important This page documents TinyMCE 5. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../../latest/apis/tinymce.dom.rangeutils/).
# tinymce.dom.RangeUtils

This class contains a few utility methods for ranges.

## Summary

### Methods

| Name | Summary | Defined by |
| --- | --- | --- |
| [compareRanges()](#compareRanges) | Compares two ranges and checks if they are equal. | `RangeUtils` |
| [getCaretRangeFromPoint()](#getCaretRangeFromPoint) | Gets the caret range for the given x/y location. | `RangeUtils` |

## Methods

### compareRanges()

```javascript
compareRanges(rng1: RangeObject, rng2: RangeObject): Boolean
```
Compares two ranges and checks if they are equal.

#### Parameters

- `rng1 (RangeObject)` - First range to compare.
- `rng2 (RangeObject)` - First range to compare.

#### Return value

- `Boolean` - True or false if the ranges are equal.

### getCaretRangeFromPoint()

```javascript
getCaretRangeFromPoint(clientX: Number, clientY: Number, doc: Document): Range
```
Gets the caret range for the given x/y location.

#### Parameters

- `clientX (Number)` - X coordinate for range
- `clientY (Number)` - Y coordinate for range
- `doc (Document)` - Document that the x and y coordinates are relative to

#### Return value

- `Range` - Caret range
