1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 23:57:59 +01:00

Escaping the error.

A error occurs if the element has been removed when "elem.selectionStart" is executed.

e.g.
  Press "gi<ESC>" on
  <input type="text" onfocus="this.parentNode.removeChild(this)" />
This commit is contained in:
anekos
2009-02-23 04:55:51 +09:00
parent bbb22074a9
commit e459c7c867

View File

@@ -607,8 +607,12 @@ function Editor() //{{{
unselectText: function () unselectText: function ()
{ {
let elem = window.document.commandDispatcher.focusedElement; let elem = window.document.commandDispatcher.focusedElement;
if (elem && elem.selectionEnd) // A error occurs if the element has been removed when "elem.selectionStart" is executed.
elem.selectionEnd = elem.selectionStart; try {
if (elem && elem.selectionEnd)
elem.selectionEnd = elem.selectionStart;
}
catch (e) {}
}, },
selectedText: function () selectedText: function ()