diff options
author | anekos <anekos@snca.net> | 2009-02-23 04:55:51 +0900 |
---|---|---|
committer | anekos <anekos@snca.net> | 2009-02-23 04:55:51 +0900 |
commit | e459c7c867cd0fb5ebb650e47bb48a9094a1fffc (patch) | |
tree | bf0c564f930875e8f265bfa382f370bad67bb540 /common/content/editor.js | |
parent | bbb22074a90da7d40ad9f00921c69c6cede70631 (diff) | |
download | pentadactyl-e459c7c867cd0fb5ebb650e47bb48a9094a1fffc.tar.gz |
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)" />
Diffstat (limited to 'common/content/editor.js')
-rw-r--r-- | common/content/editor.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/content/editor.js b/common/content/editor.js index b24422bf..b62aad98 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -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 () |