Page MenuHomePhabricator

Selective serializer discards edits in nodes that have templated attributes (mw:ExpandedAttrs typeof)
Closed, ResolvedPublic

Description

See below:

[subbu@earth parsoid] echo '<div style="{{1x|color:red;}}%">foo</div>' > /tmp/wt
[subbu@earth parsoid] parse.js < /tmp/wt > /tmp/old.html
[subbu@earth parsoid] sed 's/foo/foo and bar/g;' < /tmp/old.html > /tmp/new.html
[subbu@earth parsoid] parse.js --selser --html2wt --oldtextfile /tmp/wt --oldhtmlfile /tmp/old.html < /tmp/new.html
<div style="{{1x|color:red;}}%">foo</div>

[subbu@earth parsoid] parse.js --html2wt < /tmp/new.html
<div style="{{1x|color:red;}}%">foo and bar</div>

Looks like a problem with dom diff.

Event Timeline

Problem is with DOMUtils.isTplOrExtToplevelNode which looks for a Parsoid about-id as a proxy for a templated or extension node. This pulls in mw:ExpandedAttrs nodes as well. Perhaps, we need to get rid of the fragile proxy check and use isEncapsulationWrapper check everywhere instead. isTplOrExtToplevelNode should probably renamed to hasParsoidAboutId instead.

Change 297440 had a related patch set uploaded (by Subramanya Sastry):
DOMDiff: Skip over encapsulated content rather than about-id content

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

Change 297440 merged by jenkins-bot:
DOMDiff: Skip over encapsulated content rather than about-id content

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

ssastry claimed this task.

Now fixed. Will be deployed Monday likely.