* @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)
| 5793 | * -@return {start: selectionStart, end: selectionEnd} |
| 5794 | */ |
| 5795 | function getSelection$1(input) { |
| 5796 | var selection = void 0; |
| 5797 | |
| 5798 | if ('selectionStart' in input) { |
| 5799 | // Modern browser with input or textarea. |
| 5800 | selection = { |
| 5801 | start: input.selectionStart, |
| 5802 | end: input.selectionEnd |
| 5803 | }; |
| 5804 | } else { |
| 5805 | // Content editable or old IE textarea. |
| 5806 | selection = getOffsets(input); |
| 5807 | } |
| 5808 | |
| 5809 | return selection || { start: 0, end: 0 }; |
| 5810 | } |
| 5811 | |
| 5812 | /** |
| 5813 | * @setSelection: Sets the selection bounds of a textarea or input and focuses |
no test coverage detected