selection: ensure that `this.range` is defined

In `getContaining()` and `placeMarkers()` functions.

Prevents uncaught errors as described in #204.
+1 to all the proposed improvements.

However, this patch fixes a bug in the current situation, so it would be nice indeed to get it merged. As a workaround we're having to check that `selection.range` exists before calling placeMarkers(), which is pretty lame.