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

Function setSelection

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

* @setSelection: Sets the selection bounds of a textarea or input and focuses * the input. * -@input Set selection bounds of this input or textarea * -@offsets Object of same form that is returned from get*

(input, offsets)

Source from the content-addressed store, hash-verified

10747 */
10748
10749 function setSelection(input, offsets) {
10750 var start = offsets.start,
10751 end = offsets.end;
10752
10753 if (end === undefined) {
10754 end = start;
10755 }
10756
10757 if ('selectionStart' in input) {
10758 input.selectionStart = start;
10759 input.selectionEnd = Math.min(end, input.value.length);
10760 } else {
10761 setOffsets(input, offsets);
10762 }
10763 }
10764
10765 var validateDOMNesting = function () {};
10766

Callers 1

restoreSelectionFunction · 0.85

Calls 1

setOffsetsFunction · 0.85

Tested by

no test coverage detected