* @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)
| 5921 | * -@return {start: selectionStart, end: selectionEnd} |
| 5922 | */ |
| 5923 | function getSelection$1(input) { |
| 5924 | var selection = void 0; |
| 5925 | |
| 5926 | if ('selectionStart' in input) { |
| 5927 | // Modern browser with input or textarea. |
| 5928 | selection = { |
| 5929 | start: input.selectionStart, |
| 5930 | end: input.selectionEnd |
| 5931 | }; |
| 5932 | } else { |
| 5933 | // Content editable or old IE textarea. |
| 5934 | selection = getOffsets(input); |
| 5935 | } |
| 5936 | |
| 5937 | return selection || { start: 0, end: 0 }; |
| 5938 | } |
| 5939 | |
| 5940 | /** |
| 5941 | * @setSelection: Sets the selection bounds of a textarea or input and focuses |
no test coverage detected