Page MenuHomePhabricator

Tags split in table attribute fixups should be marked for linting
Open, MediumPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Create a page with the following content on en.WP:
{| class="wikitable" width=100%
| <center>{{N/A|Non-album single}}</center>
|}

See https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox&oldid=1124151419 for an example.

What happens?:
No Linter errors are detected.

What should have happened instead?:
Linter should report a stripped center tag, and ideally an obsolete center tag.

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

{{N/A|Non-album single}} expands to

data-sort-value="" style="background: #ececec; color: #2C2C2C; vertical-align: middle; text-align: center; " class="table-na" | Non-album single

meaning that the opening <center> tag will be in the table cell attribute position and isn't an allowed attribute name, so will be sanitized.

{{N/A|Non-album single}} expands to

data-sort-value="" style="background: #ececec; color: #2C2C2C; vertical-align: middle; text-align: center; " class="table-na" | Non-album single

meaning that the opening <center> tag will be in the table cell attribute position and isn't an allowed attribute name, so will be sanitized.

Be that as it may, the stripped </center> tag is still present and undetected.

That's true

This reparse scenario where the node gets split is known Ex: "| foobar <div> x | y </div>" will split the <div>
https://github.com/wikimedia/parsoid/blob/master/src/Wt2Html/PP/Handlers/TableFixups.php#L582

but resetting the content is naive DOMCompat::setInnerHTML( $cell, preg_replace( '/^[^|]*\|/', '', DOMCompat::getInnerHTML( $cell ) ) );
https://github.com/wikimedia/parsoid/blob/master/src/Wt2Html/PP/Handlers/TableFixups.php#L425-L430

and doesn't set the strip marker the linter depends on,
https://github.com/wikimedia/parsoid/blob/master/src/Wt2Html/PP/Processors/Linter.php#L416

Arlolra renamed this task from Center tag sometimes not detected in wikitable code to Tags split in table attribute fixups should be marked for linting.Nov 28 2022, 11:11 PM
Arlolra triaged this task as Medium priority.
Arlolra added a project: Parsoid.
Arlolra moved this task from Needs Triage to Linting on the Parsoid board.