From b232b664e08921b114e383f0fc9802b819c5806b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 23 Jan 2014 09:52:10 +0100 Subject: [PATCH] smartxml: fix ranges returned by unwrapContents --- src/smartxml/core.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/smartxml/core.js b/src/smartxml/core.js index ae6d20e..a2dd0aa 100644 --- a/src/smartxml/core.js +++ b/src/smartxml/core.js @@ -179,12 +179,12 @@ var elementNodeTransformations = { var prev = this.prev(), next = this.next(), - moveLeftRange, moveRightRange, leftMerged; + shiftRange, leftMerged; if(prev && (prev.nodeType === TEXT_NODE) && (myContents[0].nodeType === TEXT_NODE)) { prev.appendText(myContents[0].getText()); myContents[0].detach(); - moveLeftRange = true; + shiftRange = true; leftMerged = true; } else { leftMerged = false; @@ -195,7 +195,6 @@ var elementNodeTransformations = { if(next && (next.nodeType === TEXT_NODE) && (lastContents.nodeType === TEXT_NODE)) { next.prependText(lastContents.getText()); lastContents.detach(); - moveRightRange = true; } } @@ -207,8 +206,8 @@ var elementNodeTransformations = { this.detach(); return { - element1: parent.contents()[myIdx + (moveLeftRange ? -1 : 0)], - element2: parent.contents()[myIdx + childrenLength-1 + (moveRightRange ? 1 : 0)] + element1: parent.contents()[myIdx + (shiftRange ? -1 : 0)], + element2: parent.contents()[myIdx + childrenLength-1 + (shiftRange ? -1 : 0)] }; }, -- 2.20.1