jenkins-bot has submitted this change and it was merged.

Change subject: Move block inside the test and add missing diff mark
......................................................................


Move block inside the test and add missing diff mark

 * A diff mark for `last` was missing. And added some flags to not
   recurse where unnecessary.

 * Moving the block should have been part of:
   I3ebdc361128c6c2750925ff1a7a32dcf6a9d9b33

Change-Id: I95ab70238cc1d9d57a71dee5c11c3ecb93de60a8
---
M lib/wts.normalizeDOM.js
1 file changed, 8 insertions(+), 7 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/wts.normalizeDOM.js b/lib/wts.normalizeDOM.js
index cf65fbd..931bd3d 100644
--- a/lib/wts.normalizeDOM.js
+++ b/lib/wts.normalizeDOM.js
@@ -206,18 +206,19 @@
        // Conditional on rtTestMode to reduce the noise in testing.
        if (!this.inRtTestMode && endsInSpace) {
                last.nodeValue = last.nodeValue.substring(0, endsInSpace.index);
-               if (!DU.isText(next)) {
-                       var txt = node.ownerDocument.createTextNode('');
-                       node.parentNode.insertBefore(txt, next);
-                       next = txt;
-               }
                // Try to be a little smarter and drop the spaces if possible.
                if (!/^\s+/.test(next.nodeValue)) {
+                       if (!DU.isText(next)) {
+                               var txt = node.ownerDocument.createTextNode('');
+                               node.parentNode.insertBefore(txt, next);
+                               next = txt;
+                       }
                        next.nodeValue = endsInSpace[0] + next.nodeValue;
                        // next (a text node) is new / had new content added to 
it
-                       this.addDiffMarks(next, 'inserted');
+                       this.addDiffMarks(next, 'inserted', true);
                }
-               this.addDiffMarks(node, 'children-changed');
+               this.addDiffMarks(last, 'inserted', true);
+               this.addDiffMarks(node, 'children-changed', true);
                this.addDiffMarks(node.parentNode, 'children-changed');
        }
 };

-- 
To view, visit https://gerrit.wikimedia.org/r/230958
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I95ab70238cc1d9d57a71dee5c11c3ecb93de60a8
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to