Subramanya Sastry has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/80513


Change subject: (Bug 53229): Dont strip sole child if it is an element
......................................................................

(Bug 53229): Dont strip sole child if it is an element

* en:Jay_Bouwmeester had an autoinserted <td> with an empty
  <b></b> node inside and was being stripped by the dom cleanup
  and added back in which got fostered out and tripped up RT-ing.

* The previous patch was missing a check for !DU.isElt(node.firstChild)
  Added it in and that page now RTs cleanly.

Change-Id: Ic7b81bd99c95e31d251fbcf5fcea2320ea3082f0
---
M js/lib/dom.cleanup.js
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/13/80513/1

diff --git a/js/lib/dom.cleanup.js b/js/lib/dom.cleanup.js
index 36354c6..f9a026d 100644
--- a/js/lib/dom.cleanup.js
+++ b/js/lib/dom.cleanup.js
@@ -35,10 +35,11 @@
                if (dp) {
                        // Delete empty auto-inserted elements
                        var next = node.nextSibling;
-                       if ((node.childNodes.length === 0 ||
-                                               node.childNodes.length === 1 && 
/^\s*$/.test(node.textContent)) &&
-                                       dp.autoInsertedStart && 
dp.autoInsertedEnd) {
-                               if (node.childNodes.length === 1) {
+                       if (dp.autoInsertedStart && dp.autoInsertedEnd &&
+                               (node.childNodes.length === 0 ||
+                               node.childNodes.length === 1 && 
!DU.isElt(node.firstChild) && /^\s*$/.test(node.textContent)))
+                       {
+                               if (node.firstChild) {
                                        // migrate the ws out
                                        
node.parentNode.insertBefore(node.firstChild, node);
                                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7b81bd99c95e31d251fbcf5fcea2320ea3082f0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to