From 7c16ef8bac4e6420bb7d11bbdf22cb7919c06a30 Mon Sep 17 00:00:00 2001 From: Aditya Bhatt Date: Tue, 7 May 2013 15:38:42 +0000 Subject: [PATCH] code restructuring. --- webodf/lib/core/Cursor.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/webodf/lib/core/Cursor.js b/webodf/lib/core/Cursor.js index bcf9b70e..cd34cfc2 100644 --- a/webodf/lib/core/Cursor.js +++ b/webodf/lib/core/Cursor.js @@ -111,12 +111,15 @@ core.Cursor = function Cursor(selection, document) { runtime.assert(Boolean(cursorNode.parentNode), "cursorNode.parentNode is undefined"); + // Merge the left and right textnodes - if (prev && prev.nodeType === 3 && prev.length > 0) { + if (prev && prev.nodeType === 3) { textNodeIncrease = prev.length; - if (next && next.nodeType === 3 && next.length > 0) { + if (next && next.nodeType === 3) { + if (prev.length > 0) { + next.insertData(0, prev.data); + } prev.parentNode.removeChild(prev); - next.insertData(0, prev.data); } }