`? 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 the other 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 important information because it affects whether or not the typed text will be bold, too.
To handle that, selection also {@link module:engine/model/selection~Selection#setAttribute has attributes}. 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, it has just been said that inside `` there are two text nodes: `"Foo "` and `"bar"`. If you know how [native DOM Ranges](https://developer.mozilla.org/en-US/docs/Web/API/Range) work you might thus 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, CKEditor 5 uses the concepts of **indexes** and **offsets**. Indexes relate to nodes (elements and text nodes) while offsets relate 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 also defines three main classes which operate 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 documentation} 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