* Get an object which is a unique representation of the current selection. * * The return value will not be consistent across nodes or browsers, but * two identical selections on the same node will return identical objects. * * @param {DOMElement} node * @return {object}
(node)
| 9734 | */ |
| 9735 | |
| 9736 | function getSelection$1(node) { |
| 9737 | if ('selectionStart' in node && hasSelectionCapabilities(node)) { |
| 9738 | return { |
| 9739 | start: node.selectionStart, |
| 9740 | end: node.selectionEnd |
| 9741 | }; |
| 9742 | } else { |
| 9743 | var win = node.ownerDocument && node.ownerDocument.defaultView || window; |
| 9744 | var selection = win.getSelection(); |
| 9745 | return { |
| 9746 | anchorNode: selection.anchorNode, |
| 9747 | anchorOffset: selection.anchorOffset, |
| 9748 | focusNode: selection.focusNode, |
| 9749 | focusOffset: selection.focusOffset |
| 9750 | }; |
| 9751 | } |
| 9752 | } |
| 9753 | /** |
| 9754 | * Get document associated with the event target. |
| 9755 | * |
no test coverage detected