* @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)
| 5944 | * -@offsets Object of same form that is returned from get* |
| 5945 | */ |
| 5946 | function setSelection(input, offsets) { |
| 5947 | var start = offsets.start, |
| 5948 | end = offsets.end; |
| 5949 | |
| 5950 | if (end === undefined) { |
| 5951 | end = start; |
| 5952 | } |
| 5953 | |
| 5954 | if ('selectionStart' in input) { |
| 5955 | input.selectionStart = start; |
| 5956 | input.selectionEnd = Math.min(end, input.value.length); |
| 5957 | } else { |
| 5958 | setOffsets(input, offsets); |
| 5959 | } |
| 5960 | } |
| 5961 | |
| 5962 | var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; |
| 5963 |
no test coverage detected