MCPcopy
hub / github.com/autoNumeric/autoNumeric / _setSelection

Method _setSelection

src/AutoNumeric.js:8697–8708  ·  view source on GitHub ↗

* Set the text selection inside the input with the given start and end position. * * @param {number} start * @param {number} end * @private

(start, end)

Source from the content-addressed store, hash-verified

8695 * @private
8696 */
8697 _setSelection(start, end) {
8698 //TODO use this function to replace the direct calls to `setElementSelection()`, wherever possible
8699 start = Math.max(start, 0);
8700 end = Math.min(end, AutoNumericHelper.getElementValue(this.domElement).length);
8701 this.selection = {
8702 start,
8703 end,
8704 length: end - start,
8705 };
8706
8707 AutoNumericHelper.setElementSelection(this.domElement, start, end);
8708 }
8709
8710 /**
8711 * Set the caret position inside the input at the given position.

Callers 3

_setCaretPositionMethod · 0.95

Calls 2

getElementValueMethod · 0.80
setElementSelectionMethod · 0.80

Tested by

no test coverage detected