mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 10:17:59 +01:00
Add some editor assertions.
This commit is contained in:
@@ -409,6 +409,7 @@ var Editor = Module("editor", {
|
|||||||
|
|
||||||
if (!(node instanceof Ci.nsIDOMText)) {
|
if (!(node instanceof Ci.nsIDOMText)) {
|
||||||
node = iterator[forward ? "getNext" : "getPrev"]();
|
node = iterator[forward ? "getNext" : "getPrev"]();
|
||||||
|
dactyl.assert(node);
|
||||||
range[forward ? "setEnd" : "setStart"](node, forward ? 0 : node.textContent.length);
|
range[forward ? "setEnd" : "setStart"](node, forward ? 0 : node.textContent.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,6 +554,7 @@ var Editor = Module("editor", {
|
|||||||
function clear(forward, re)
|
function clear(forward, re)
|
||||||
function _clear(editor) {
|
function _clear(editor) {
|
||||||
updateRange(editor, forward, re, function (range) {});
|
updateRange(editor, forward, re, function (range) {});
|
||||||
|
dactyl.assert(!editor.selection.isCollapsed);
|
||||||
editor.selection.deleteFromDocument();
|
editor.selection.deleteFromDocument();
|
||||||
let parent = DOM(editor.rootElement.parentNode);
|
let parent = DOM(editor.rootElement.parentNode);
|
||||||
if (parent.isInput)
|
if (parent.isInput)
|
||||||
|
|||||||
Reference in New Issue
Block a user