Page MenuHomePhabricator

Mismatched closing </b> tag added
Closed, ResolvedPublic

Description

Mismatched closing </b> tag was added in these edits:

Perhaps it is notable that the addition directly precedes an apostrophe '.

Event Timeline

There is misnested <i><b>...</i></b> (HTML tags, not wikitetx) in there and I suspect something is broken with DSR computation in the wt->html direction causing this. This is some edge case but my recommendation is to just fix up the wikitext and the bad nesting.

Arlolra triaged this task as Medium priority.Jul 12 2021, 7:57 PM
Arlolra moved this task from Needs Triage to Bugs & Crashers on the Parsoid board.
Arlolra added a subscriber: Arlolra.

The example :<i><b>draftify</i></b> renders as,

<dl data-parsoid='{"dsr":[0,23,0,0]}'><dd data-parsoid='{"dsr":[0,23,1,0]}'><i data-parsoid='{"stx":"html","dsr":[1,23,3,4]}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[4,15,3,0]}'>draftify</b></i><meta typeof="mw:Placeholder/StrippedTag" data-parsoid='{"src":"&lt;/b>","name":"b","dsr":[23,23,null,null]}'/></dd></dl>

The <i> is given the dsr of the stripped </b> and then the placeholder double counts it.

The placeholder has zero width there, so, the DSR should line up properly.

In wt->html we used to remove the StrippedTag placeholders but recently modified that behavior for stripped tags in list items, so maybe that is the bug here ... if we leave it behind, we should fix up the DSR to give it back its non-zero width.

But, this should impact any stripped closing tag in a list item, not just in this misnested scenario ... so there is that piece as well.

The <i> is given the dsr of the stripped </b> and then the placeholder double counts it.

What I meant was that if, for whatever reason, the source is used for the <i> but not the placeholder, you'll get a doubling up.

Looking at the conditions for when zero length content is reused, it seems like <meta> tags are excluded so the placeholder content will always be restored,
https://github.com/wikimedia/parsoid/blob/master/src/Html2Wt/WikitextSerializer.php#L1129-L1136

Aha .... curious why we have that exception there for specific node names.

Change 704633 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] Allow zero-width stripped tags to serialize from source

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

Change 704633 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Fix DSR for unstripped stray closing tags & add b/c handling in selser

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

Change 705497 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.14.0-a8

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

Change 705497 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.14.0-a8

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