diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 8fdc319e..c21d5a29 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -326,9 +326,15 @@ DomUtils = @suppressEvent event handlerStack.suppressEvent - + # Polyfill for selection.type (which is not available in Firefox). getSelectionType: (selection) -> - selection.type + selection.type or do -> + if selection.rangeCount == 0 + "None" + else if selection.isCollapsed + "Caret" + else + "Range" # Adapted from: http://roysharon.com/blog/37. # This finds the element containing the selection focus. |
