MCPcopy Create free account
hub / github.com/microsoft/SandDance / setSelection

Function setSelection

docs/external/js/react-dom.development.js:7177–7191  ·  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

7175 */
7176
7177 function setSelection(input, offsets) {
7178 var start = offsets.start,
7179 end = offsets.end;
7180
7181 if (end === undefined) {
7182 end = start;
7183 }
7184
7185 if ('selectionStart' in input) {
7186 input.selectionStart = start;
7187 input.selectionEnd = Math.min(end, input.value.length);
7188 } else {
7189 setOffsets(input, offsets);
7190 }
7191 }
7192
7193 var validateDOMNesting = function () {};
7194

Callers 1

restoreSelectionFunction · 0.85

Calls 2

setOffsetsFunction · 0.85
minMethod · 0.45

Tested by

no test coverage detected