* 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)
| 13306 | */ |
| 13307 | |
| 13308 | function getSelection$1(node) { |
| 13309 | if ('selectionStart' in node && hasSelectionCapabilities(node)) { |
| 13310 | return { |
| 13311 | start: node.selectionStart, |
| 13312 | end: node.selectionEnd |
| 13313 | }; |
| 13314 | } else { |
| 13315 | var win = node.ownerDocument && node.ownerDocument.defaultView || window; |
| 13316 | var selection = win.getSelection(); |
| 13317 | return { |
| 13318 | anchorNode: selection.anchorNode, |
| 13319 | anchorOffset: selection.anchorOffset, |
| 13320 | focusNode: selection.focusNode, |
| 13321 | focusOffset: selection.focusOffset |
| 13322 | }; |
| 13323 | } |
| 13324 | } |
| 13325 | /** |
| 13326 | * Get document associated with the event target. |
| 13327 | * |
no test coverage detected