* @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)
| 6595 | * -@return {start: selectionStart, end: selectionEnd} |
| 6596 | */ |
| 6597 | function getSelection$1(input) { |
| 6598 | var selection = void 0; |
| 6599 | |
| 6600 | if ('selectionStart' in input) { |
| 6601 | // Modern browser with input or textarea. |
| 6602 | selection = { |
| 6603 | start: input.selectionStart, |
| 6604 | end: input.selectionEnd |
| 6605 | }; |
| 6606 | } else { |
| 6607 | // Content editable or old IE textarea. |
| 6608 | selection = getOffsets(input); |
| 6609 | } |
| 6610 | |
| 6611 | return selection || { start: 0, end: 0 }; |
| 6612 | } |
| 6613 | |
| 6614 | /** |
| 6615 | * @setSelection: Sets the selection bounds of a textarea or input and focuses |
no test coverage detected