* @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)
| 6811 | * -@return {start: selectionStart, end: selectionEnd} |
| 6812 | */ |
| 6813 | function getSelection$1(input) { |
| 6814 | var selection = void 0; |
| 6815 | |
| 6816 | if ('selectionStart' in input) { |
| 6817 | // Modern browser with input or textarea. |
| 6818 | selection = { |
| 6819 | start: input.selectionStart, |
| 6820 | end: input.selectionEnd |
| 6821 | }; |
| 6822 | } else { |
| 6823 | // Content editable or old IE textarea. |
| 6824 | selection = getOffsets(input); |
| 6825 | } |
| 6826 | |
| 6827 | return selection || { start: 0, end: 0 }; |
| 6828 | } |
| 6829 | |
| 6830 | /** |
| 6831 | * @setSelection: Sets the selection bounds of a textarea or input and focuses |
no test coverage detected