# engine/model/utils/getselectedcontent

module

<a id="functions">

## Functions

<a id="function-getSelectedContent">

### `getSelectedContent( model, selection ) → ModelDocumentFragment` _(internal)_

Gets a clone of the selected content.

For example, for the following selection:

```html
<p>x</p><quote><p>y</p><h>fir[st</h></quote><p>se]cond</p><p>z</p>
```

It will return a document fragment with such a content:

```html
<quote><h>st</h></quote><p>se</p>
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/model/utils/getselectedcontent.ts#L37)

#### Parameters

* `model: Model`

  The model in context of which the selection modification should be performed.

* `selection: ModelSelection | ModelDocumentSelection`

  The selection of which content will be returned.

#### Returns

* `ModelDocumentFragment`

---

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