OscarGodson/EpicEditor — pull request #219 by hongymagic (2013-04-08 06:23:08+00:00)
Title: Add private method _getSelection

Adds private method `_getSelection(iframe)` as requested in [this comment](https://github.com/hongymagic/EpicEditor/commit/c16f3ac75046625ec7cd5aa098bba895f5230235#commitcomment-2961593).

```javascript
var selection = _getSelection(self.editorIframe);
```

Will return a native Selection object. There are a couple of things to note going forward, I'll keep them short here:

1. To get caret position, we will need to query the selection object for text ranges. Remember the ugly [offset calculation](https://github.com/hongymagic/EpicEditor/blob/feature/newline/src/editor.js#L147)? This will be required to get the accurate caret position
2. Other commonly tested paths such as: `if (selection.rangeCount > 0) range = selection.getRangeAt(0)` could also be extracted out as a private function. I will leave that out for now