* @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)
| 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 |
no test coverage detected