# ViewElementAttributeValue

interface

Common interface for a [`ViewTokenList`](module_engine_view_tokenlist-ViewTokenList.md) and [`StylesMap`](module_engine_view_stylesmap-StylesMap.md).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1229)

<a id="properties">

## Properties

<a id="member-isEmpty">

### `isEmpty: boolean` _(readonly)_

Returns `true` if attribute has no value set.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1234)

<a id="member-size">

### `size: number` _(readonly)_

Number of tokens (styles, classes or other tokens) defined.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1239)

<a id="methods">

## Methods

<a id="function-_canMergeFrom">

### `_canMergeFrom( other ) → boolean`

Used by [`_canMergeAttributesFrom`](module_engine_view_element-ViewElement.md#function-_canMergeAttributesFrom) to verify if the given attribute can be merged without conflicts into the attribute.

This method is indirectly used by the [`ViewDowncastWriter`](module_engine_view_downcastwriter-ViewDowncastWriter.md) while down-casting an [`ViewAttributeElement`](module_engine_view_attributeelement-ViewAttributeElement.md) to merge it with other ViewAttributeElement.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1318)

#### Parameters

* `other: this`

#### Returns

* `boolean`

<a id="function-_clone">

### `_clone() → this`

Clones the attribute value.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1289)

#### Returns

* `this`

<a id="function-_getConsumables">

### `_getConsumables( name? ) → Array<string>`

Returns a list of consumables for the attribute. This includes related tokens (for example other forms of notation of the same style property).

Could be filtered by the given token name (class name, style property, etc.).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1309)

#### Parameters

* `name?: string`

#### Returns

* `Array<string>`

<a id="function-_getTokensMatch">

### `_getTokensMatch( tokenPattern, valuePattern? ) → Array<string> | undefined`

Used by the [Matcher](module_engine_view_matcher-Matcher.md) to collect matching attribute tokens.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1298)

#### Parameters

* `tokenPattern: string | true | RegExp`

  The matched token name pattern.

* `valuePattern?: string | true | RegExp`

  The matched token value pattern.

#### Returns

* `Array<string> | undefined`

  An array of matching tokens.

<a id="function-_isMatching">

### `_isMatching( other ) → boolean`

Used by [`_canSubtractAttributesOf`](module_engine_view_element-ViewElement.md#function-_canSubtractAttributesOf) to verify if the given attribute can be fully subtracted from the attribute.

This method is indirectly used by the [`ViewDowncastWriter`](module_engine_view_downcastwriter-ViewDowncastWriter.md) while down-casting an [`ViewAttributeElement`](module_engine_view_attributeelement-ViewAttributeElement.md) to unwrap the ViewAttributeElement.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1334)

#### Parameters

* `other: this`

#### Returns

* `boolean`

<a id="function-_mergeFrom">

### `_mergeFrom( other ) → void`

Used by [`_mergeAttributesFrom`](module_engine_view_element-ViewElement.md#function-_mergeAttributesFrom) to merge a given attribute into the attribute.

This method is indirectly used by the [`ViewDowncastWriter`](module_engine_view_downcastwriter-ViewDowncastWriter.md) while down-casting an [`ViewAttributeElement`](module_engine_view_attributeelement-ViewAttributeElement.md) to merge it with other ViewAttributeElement.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1326)

#### Parameters

* `other: this`

#### Returns

* `void`

<a id="function-clear">

### `clear() → void`

Removes all tokens.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1274)

#### Returns

* `void`

<a id="function-has">

### `has( name ) → boolean`

Checks if a given token (style, class, token) is set.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1244)

#### Parameters

* `name: string`

#### Returns

* `boolean`

<a id="function-isSimilar">

### `isSimilar( other ) → boolean`

Returns `true` if both attributes have the same content.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1284)

#### Parameters

* `other: this`

#### Returns

* `boolean`

<a id="function-keys">

### `keys() → Array<string>`

Returns all tokens (styles, classes, other tokens).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1249)

#### Returns

* `Array<string>`

<a id="function-remove">

### `remove( tokens ) → void`

Removes given token (style, class, other token).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1269)

#### Parameters

* `tokens: ArrayOrItem<string>`

#### Returns

* `void`

<a id="function-set">

### `set( stylesOrTokens ) → void`

Sets a given token (for style also a record of properties).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1264)

#### Parameters

* `stylesOrTokens: Styles | ArrayOrItem<string>`

#### Returns

* `void`

<a id="function-set">

### `set( name, value ) → void`

Sets a given style property and value.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1259)

#### Parameters

* `name: string`
* `value: StyleValue`

#### Returns

* `void`

<a id="function-setTo">

### `setTo( value ) → this`

Resets the value to the given one.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1254)

#### Parameters

* `value: string`

#### Returns

* `this`

<a id="function-toString">

### `toString() → string`

Returns a normalized tokens string (styles, classes, etc.).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/element.ts#L1279)

#### Returns

* `string`

---

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