mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
js: Remove ancient IE createTextRange API.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
fa81ae3aa4
commit
9518545128
@@ -11,19 +11,12 @@ export function change_tab_to(tabname) {
|
||||
export function place_caret_at_end(el) {
|
||||
el.focus();
|
||||
|
||||
if (window.getSelection !== undefined && document.createRange !== undefined) {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(el);
|
||||
range.collapse(false);
|
||||
const sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
} else if (document.body.createTextRange !== undefined) {
|
||||
const textRange = document.body.createTextRange();
|
||||
textRange.moveToElementText(el);
|
||||
textRange.collapse(false);
|
||||
textRange.select();
|
||||
}
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(el);
|
||||
range.collapse(false);
|
||||
const sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
}
|
||||
|
||||
export function blur_active_element() {
|
||||
|
||||
Reference in New Issue
Block a user