MCPcopy Create free account
hub / github.com/reactjs/react-rails / getSelection$1

Function getSelection$1

lib/assets/react-source/development/react.js:13308–13324  ·  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

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 *

Callers 1

constructSelectEventFunction · 0.85

Calls 1

hasSelectionCapabilitiesFunction · 0.85

Tested by

no test coverage detected