This commit is contained in:
Dennis Eichhorn 2018-02-03 11:38:30 +01:00
parent 340cda9c1e
commit b69556e07e
2 changed files with 10 additions and 11 deletions

View File

@ -31,10 +31,9 @@
const activeEl = document.activeElement;
const activeElTagName = activeEl ? activeEl.tagName.toLowerCase() : null;
if (
(activeElTagName === 'textarea' || activeElTagName === 'input') &&
/^(?:text|search|password|tel|url)$/i.test(activeEl.type) &&
(typeof activeEl.selectionStart === 'number')
if ((activeElTagName === 'textarea' || activeElTagName === 'input')
&& /^(?:text|search|password|tel|url)$/i.test(activeEl.type)
&& (typeof activeEl.selectionStart === 'number')
) {
text = activeEl.value.slice(activeEl.selectionStart, activeEl.selectionEnd);
} else if (window.getSelection) {