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

Function getSelection

lib/assets/react-source/development/react.js:10723–10741  ·  view source on GitHub ↗

* @getSelection: Gets the selection bounds of a focused textarea, input or * contentEditable node. * -@input: Look up selection bounds of this input * -@return {start: selectionStart, end: selectionEnd}

(input)

Source from the content-addressed store, hash-verified

10721 */
10722
10723 function getSelection(input) {
10724 var selection;
10725
10726 if ('selectionStart' in input) {
10727 // Modern browser with input or textarea.
10728 selection = {
10729 start: input.selectionStart,
10730 end: input.selectionEnd
10731 };
10732 } else {
10733 // Content editable or old IE textarea.
10734 selection = getOffsets(input);
10735 }
10736
10737 return selection || {
10738 start: 0,
10739 end: 0
10740 };
10741 }
10742 /**
10743 * @setSelection: Sets the selection bounds of a textarea or input and focuses
10744 * the input.

Callers 1

getSelectionInformationFunction · 0.85

Calls 1

getOffsetsFunction · 0.85

Tested by

no test coverage detected