MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / getSelection$1

Function getSelection$1

code/redux/public/app.js:6813–6828  ·  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

6811 * -@return {start: selectionStart, end: selectionEnd}
6812 */
6813function getSelection$1(input) {
6814 var selection = void 0;
6815
6816 if ('selectionStart' in input) {
6817 // Modern browser with input or textarea.
6818 selection = {
6819 start: input.selectionStart,
6820 end: input.selectionEnd
6821 };
6822 } else {
6823 // Content editable or old IE textarea.
6824 selection = getOffsets(input);
6825 }
6826
6827 return selection || { start: 0, end: 0 };
6828}
6829
6830/**
6831 * @setSelection: Sets the selection bounds of a textarea or input and focuses

Callers 1

getSelectionInformationFunction · 0.70

Calls 1

getOffsetsFunction · 0.70

Tested by

no test coverage detected