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

Function getSelection$1

code/third-party/public/app.js:5795–5810  ·  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

5793 * -@return {start: selectionStart, end: selectionEnd}
5794 */
5795function getSelection$1(input) {
5796 var selection = void 0;
5797
5798 if ('selectionStart' in input) {
5799 // Modern browser with input or textarea.
5800 selection = {
5801 start: input.selectionStart,
5802 end: input.selectionEnd
5803 };
5804 } else {
5805 // Content editable or old IE textarea.
5806 selection = getOffsets(input);
5807 }
5808
5809 return selection || { start: 0, end: 0 };
5810}
5811
5812/**
5813 * @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