Set textNodeIncrease to prev.length in removeCursor even when next is

null/not a text node.
This commit is contained in:
Aditya Bhatt
2013-05-13 10:18:10 +00:00
parent 60fe6497aa
commit cd2acd5f26
+6 -5
View File
@@ -112,11 +112,12 @@ core.Cursor = function Cursor(selection, document) {
runtime.assert(Boolean(cursorNode.parentNode),
"cursorNode.parentNode is undefined");
// Merge the left and right textnodes
if ((next && next.nodeType === 3 && next.data.length > 0)
&& (prev && prev.nodeType === 3 && prev.data.length > 0)) {
prev.parentNode.removeChild(prev);
next.insertData(0, prev.data);
textNodeIncrease = prev.data.length;
if (prev && prev.nodeType === 3 && prev.length > 0) {
textNodeIncrease = prev.length;
if (next && next.nodeType === 3 && next.length > 0) {
prev.parentNode.removeChild(prev);
next.insertData(0, prev.data);
}
}
cursorNode.parentNode.removeChild(cursorNode);