JSHint throws an error here, unless wrapped, as in:

```javascript
if (window.getSelection().rangeCount) {
  window.getSelection().collapseToEnd();
}
```