Page MenuHomePhabricator

Vue should not use loadHTML
Closed, DuplicatePublic

Description

It should use Remex instead. PHP's loadHTML has all sorts of crazy bugs and corner cases; nothing else in core uses it.

Event Timeline

cscott created this task.Jun 16 2020, 4:54 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 16 2020, 4:54 PM

Change 605964 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] WIP: don't use loadHTML, it is evil.

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

Restricted Application added a project: Performance-Team. · View Herald TranscriptJun 16 2020, 5:10 PM
Krinkle assigned this task to Catrope.Jun 22 2020, 7:52 PM
Krinkle triaged this task as Medium priority.
Krinkle moved this task from Inbox to Doing on the Performance-Team board.
Krinkle moved this task from Inbox to Confirmed Problem on the MediaWiki-ResourceLoader board.

Change 598133 had a related patch set uploaded (by Krinkle; owner: Catrope):
[mediawiki/core@master] VueComponentParser: Use RemexHtml instead of PHP's HTML parser

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

Change 605964 abandoned by Krinkle:
WIP: don't use loadHTML, it is evil.

Reason:
Superseded

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

Change 598133 merged by jenkins-bot:
[mediawiki/core@master] VueComponentParser: Use RemexHtml instead of PHP's HTML parser

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

Ah, I just noted on T253334 - I don't think RemexHtml is the right solution either - Vue templates also are not really html, as they include "elements" not in the HTML standard, and parsers may not handle them correctly. I ran into this just now using wmf/1.35.0-wmf.38 which has the RemexHtml parser, where I have an html table that has some of its rows provided by another Vue component:

<table><tbody> <tr><th>header...</th></tr> <internal-tr-component ...></internal-tr-component> </tbody></table> The parser is pulling the "internal-tr-component" outside of the table, which disrupts the display, and also confuses the validation as it thinks the template has 2 child nodes (I had to add an outer <div> to prevent the "<template> tag may not have multiple child tags" error). I think they need to be treated as straight XML, not HTML?
cscott added a comment.Jul 1 2020, 6:13 PM

See response in T253334. (Let's have this discussion over there, instead of in two places at once.)