* @getSelection: Gets the selection bounds of a focused textarea, input or * contentEditable node. * -@input: Look up selection bounds of this input * -@return {start: selectionStart, end: selectionEnd}
(input)
| 6560 | * -@return {start: selectionStart, end: selectionEnd} |
| 6561 | */ |
| 6562 | function getSelection$1(input) { |
| 6563 | var selection = void 0; |
| 6564 | |
| 6565 | if ('selectionStart' in input) { |
| 6566 | // Modern browser with input or textarea. |
| 6567 | selection = { |
| 6568 | start: input.selectionStart, |
| 6569 | end: input.selectionEnd |
| 6570 | }; |
| 6571 | } else { |
| 6572 | // Content editable or old IE textarea. |
| 6573 | selection = getOffsets(input); |
| 6574 | } |
| 6575 | |
| 6576 | return selection || { start: 0, end: 0 }; |
| 6577 | } |
| 6578 | |
| 6579 | /** |
| 6580 | * @setSelection: Sets the selection bounds of a textarea or input and focuses |
no test coverage detected