# table/tablecaption/utils

module

<a id="functions">

## Functions

<a id="function-getCaptionFromModelSelection">

### `getCaptionFromModelSelection( selection ) → ModelElement | null` _(internal)_

Returns the caption model element for a model selection. Returns `null` if the selection has no caption element ancestor.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/tablecaption/utils.ts#L51)

#### Parameters

* `selection: ModelDocumentSelection`

  The selection checked for caption presence.

#### Returns

* `ModelElement | null`

<a id="function-getCaptionFromTableModelElement">

### `getCaptionFromTableModelElement( tableModelElement ) → ModelElement | null` _(internal)_

Returns the caption model element from a given table element. Returns `null` if no caption is found.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/tablecaption/utils.ts#L35)

#### Parameters

* `tableModelElement: ModelElement`

  Table element in which we will try to find a caption element.

#### Returns

* `ModelElement | null`

<a id="function-isTable">

### `isTable( modelElement ) → boolean` _(internal)_

Checks if the provided model element is a `table`.

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

#### Parameters

* `modelElement: ModelElement | ModelDocumentFragment | null`

  Element to check if it is a table.

#### Returns

* `boolean`

<a id="function-matchTableCaptionViewElement">

### `matchTableCaptionViewElement( element ) → object | null` _(internal)_

[`Matcher`](module_engine_view_matcher-Matcher.md) pattern. Checks if a given element is a caption.

There are two possible forms of the valid caption:

* A `<figcaption>` element inside a `<figure class="table">` element.
* A `<caption>` inside a .
  |   |
  | - |

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/tablecaption/utils.ts#L71)

#### Parameters

* `element: ViewElement`

#### Returns

* `object | null`

  Returns the object accepted by [`Matcher`](module_engine_view_matcher-Matcher.md) or `null` if the element cannot be matched.

---

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