RESOLVED FIXED 254755
HTML parser: only adjust approved SVG and MathML attributes
https://bugs.webkit.org/show_bug.cgi?id=254755
Summary HTML parser: only adjust approved SVG and MathML attributes
Anne van Kesteren
Reported 2023-03-30 10:55:22 PDT
The HTML Standard is quite particular about what attributes need to be adjusted: https://html.spec.whatwg.org/#adjust-mathml-attributes. This results in 3 x 3 failures on WPT `html/syntax/parsing/html5lib_tests11.html`. The fault lies in `HTMLTreeBuilder.cpp`. It uses `SVGNames::getSVGAttrs` (and seems to be only caller of that) rather than keeping its own list of known attributes. This is also the case for how it handles MathML, XLink, and XML names, but for those there are no test failures. There are two solutions: 1. Change the tree builder to keep its own lists, similar to how the HTML Standard does it. I'm not familiar enough with C++ syntax to tackle this, but surely someone else is or can give directions. Given that the tree builder appears to be the sole consumer of `getSVGAttrs` and friends this might allow for some simplifications elsewhere in the code. 2. Remove the SVG attributes that cause the problem from `svgattrs.in`: contentScriptType, contentStyleType, and externalResourcesRequired. The first two seem fine, but the last one has some other uses it seems, but perhaps it's still safe to remove? None of these are cross-browser and technically are not supposed to work in HTML. The main problem with 2 is that we might introduce the problem again in the future so perhaps it ought to be accompanied by asserts for the various name tables that no new camelcase names are added. Thoughts appreciated.
Attachments
Radar WebKit Bug Importer
Comment 1 2023-03-30 10:55:43 PDT
Anne van Kesteren
Comment 2 2023-04-02 00:36:44 PDT
EWS
Comment 3 2023-04-03 01:25:19 PDT
Committed 262502@main (83e92a3d7ab3): <https://commits.webkit.org/262502@main> Reviewed commits have been landed. Closing PR #12289 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.