diff options
| author | Stephen Blott | 2015-01-18 06:27:38 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-18 10:25:31 +0000 |
| commit | 0e59b99e95e6a4fd3f64fd284e7417ba5f7e22e1 (patch) | |
| tree | 19fddb33de1e00b8024c4cb5c86dc483169da885 /lib/dom_utils.coffee | |
| parent | 9cb0f2853a155e39270282e6ed224966afffc61e (diff) | |
| download | vimium-0e59b99e95e6a4fd3f64fd284e7417ba5f7e22e1.tar.bz2 | |
Modes; pre-merge clean up.
Diffstat (limited to 'lib/dom_utils.coffee')
| -rw-r--r-- | lib/dom_utils.coffee | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 322188b3..e1f1f442 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -166,6 +166,14 @@ DomUtils = node = node.parentNode false + # True if element contains the active selection range. + isSelected: (element) -> + if element.isContentEditable + node = document.getSelection()?.anchorNode + node and @isDOMDescendant element, node + else + element.selectionStart? and element.selectionEnd? and element.selectionStart != element.selectionEnd + simulateSelect: (element) -> element.focus() # When focusing a textbox, put the selection caret at the end of the textbox's contents. |
