Subramanya Sastry has uploaded a new change for review.

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


Change subject: (Bug 52638) Fix selser regression introduced by fix for bug 
51217
......................................................................

(Bug 52638) Fix selser regression introduced by fix for bug 51217

* To prevent fostered content from non-templated tables from causing
  corruption (duplicated content) on save, commit 89057946294cc
  zeroed out the DSR for fostered elements.  This works fine except
  if the table was templated.  The fostered element then carries
  round-trip information for the table and gets its dsr zeroed out.

  The code was missing a check for whether the fostered element
  had rt-information on it.

* This patch fixes that oversight.

* Tested the fix on this example by making edits to the generated HTML
  before and after both tables.  Also verified parse html to check
  that fostered element in first case does not have its dsr zeroed out,
  but the second one does.

----------------
{|
{{echo|a}}
|-
|x
|}

{|
a
|-
|x
|}
----------------

$ node parse < wt > old.html
$ cp old.html new.html
$ vi new.html (and make changes)
$ node parse --selser --html2wt --oldtextfile wt --oldhtmlfile old.html < 
new.html

* We really need an updated selser testing setup or an update to our
  existing test scripts.

Bugs affected by this patch:

Bug: 51217
Bug: 52638
Bug: 52488
Change-Id: I019cdca6a1b7c504153d6182d06cdabd8732eb87
---
M js/lib/mediawiki.DOMPostProcessor.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/js/lib/mediawiki.DOMPostProcessor.js 
b/js/lib/mediawiki.DOMPostProcessor.js
index bb470fe..c858bb3 100644
--- a/js/lib/mediawiki.DOMPostProcessor.js
+++ b/js/lib/mediawiki.DOMPostProcessor.js
@@ -2981,7 +2981,7 @@
                        // Make dsr zero-range for fostered content
                        // to prevent selser from duplicating this content
                        // outside the table from where this came.
-                       if (dp.fostered && dp.dsr) {
+                       if (dp.fostered && dp.dsr && 
!DU.isEncapsulatedElt(node)) {
                                dp.dsr[0] = dp.dsr[1];
                        }
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I019cdca6a1b7c504153d6182d06cdabd8732eb87
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