MCPcopy Create free account
hub / github.com/microsoft/SandDance / getSelection$1

Function getSelection$1

docs/external/js/react-dom.development.js:9736–9752  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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 *

Callers 1

constructSelectEventFunction · 0.85

Calls 2

hasSelectionCapabilitiesFunction · 0.85
getSelectionMethod · 0.45

Tested by

no test coverage detected