`? If you use [native DOM Selection](https://developer.mozilla.org/en-US/docs/Web/API/Selection) you may get both positions – one anchored in `` and second anchored in ``. In CKEditor 5 this position translates exactly to `"Foo ^bar"`.
#### Selection attributes
OK, but how to let CKEditor 5 know that I want the selection to "be bold" in the case described above? This is an important information because it affects whether typed text will be bold too or not.
To handle that, selection {@link module:engine/model/selection~Selection#setAttribute has attributes} too. If the selection is placed in `"Foo ^bar"` and it has the attribute `bold=true` you know that the user will type bold text.
#### Positions
However, we have just said that inside `` there are two text nodes – `"Foo "` and `"bar"`. So, if you know how [native DOM Ranges](https://developer.mozilla.org/en-US/docs/Web/API/Range) work you might ask – "but if the selection is at the boundary of two text nodes, is it anchored in the left one, the right one or in the containing element?"
This is, indeed, another problem with DOM APIs – not only can positions outside and inside some element be identical visually but also, they can be anchored inside or outside a text node (if the position is at a text node boundary). This all creates extreme complications when implementing editing algorithms.
To avoid such troubles, and to make collaborative editing possible for real, in CKEditor 5 we use concepts of **indexes** and **offsets**. Indexes relate to nodes (elements and text nodes) while offsets to positions. For example, in the following structure:
```html
"Foo "
"bar"
```
The `"Foo "` text node is at index `0` in its parent, `` is at index `1` and `"bar"` is at index `2`.
On the other hand, offset `x` in `` translates to:
| offset | position | node |
|--------|--------------------------------------------------|-----------|
| `0` | `^Foo bar` | `"Foo "` |
| `1` | `F^oo bar` | `"Foo "` |
| `4` | `Foo ^bar` | `` |
| `6` | `Foo b^ar` | `"bar"` |
The engine defines also 3 main classes which operates on offsets:
* A {@link module:engine/model/position~Position} instance contains an {@link module:engine/model/position~Position#path array of offsets} (which is called a "path"). See the examples in {@link module:engine/model/position~Position#path `Position#path` API docs} to better understand how paths work.
* {@link module:engine/model/range~Range} contains two positions – {@link module:engine/model/range~Range#start start} and {@link module:engine/model/range~Range#end end} ones.
* finally, there is {@link module:engine/model/selection~Selection} which contains one or more ranges and attributes.
### View
### Controller
## UI library