# typing/utils/findattributerange

module

<a id="functions">

## Functions

<a id="function-findAttributeRange">

### `findAttributeRange( position, attributeName, value, model ) → ModelRange`

Returns a model range that covers all consecutive nodes with the same `attributeName` and its `value` that intersect the given `position`.

It can be used e.g. to get the entire range on which the `linkHref` attribute needs to be changed when having a selection inside a link.

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

#### Parameters

* `position: ModelPosition`

  The start position.

* `attributeName: string`

  The attribute name.

* `value: unknown`

  The attribute value.

* `model: Model`

  The model instance.

#### Returns

* `ModelRange`

  The link range.

<a id="function-findAttributeRangeBound">

### `findAttributeRangeBound( position, attributeName, value, lookBack, model ) → ModelPosition`

Walks forward or backward (depends on the `lookBack` flag), node by node, as long as they have the same attribute value and returns a position just before or after (depends on the `lookBack` flag) the last matched node.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-typing/src/utils/findattributerange.ts#L47)

#### Parameters

* `position: ModelPosition`

  The start position.

* `attributeName: string`

  The attribute name.

* `value: unknown`

  The attribute value.

* `lookBack: boolean`

  Whether the walk direction is forward (`false`) or backward (`true`).

* `model: Model`

#### Returns

* `ModelPosition`

  The position just before the last matched node.

---

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