1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 21:37:57 +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 ()
{
let elem = window.document.commandDispatcher.focusedElement;
if (elem && elem.selectionEnd)
elem.selectionEnd = elem.selectionStart;
// A error occurs if the element has been removed when "elem.selectionStart" is executed.
try {
if (elem && elem.selectionEnd)
elem.selectionEnd = elem.selectionStart;
}
catch (e) {}
},
selectedText: function ()