Use html-element-attributes and svg-element-attributes #3019
Labels
enhancement
Up for grabs
Issues that are relatively small, self-contained, and ready for implementation
This affects attribute validation in
@lwc/template-compiler
, which currently surfaces as warnings.The libraries html-element-attributes and svg-element-attributes contain mappings of valid HTML tag/attribute pairs. They each have ~70-80k weekly npm downloads and seem fairly up-to-date.
Currently we are using a vendor'ed copy of the first:
lwc/packages/@lwc/template-compiler/src/parser/utils/html-element-attributes.ts
Lines 34 to 43 in 2ddff92
... and for the second, we are just assuming that all known SVG elements are good, regardless of what attributes they have:
lwc/packages/@lwc/template-compiler/src/parser/attribute.ts
Line 222 in dba53e7
lwc/packages/@lwc/template-compiler/src/parser/constants.ts
Lines 58 to 61 in 9246638
Rather than maintaining our own list of valid html tag/attribute mappings (which can get out-of-date or be inaccurate), we should pool efforts with a reliable third-party package like these ones.
Unfortunately these two packages both switched to ESM recently, so we would need to solve #3017 first.
The text was updated successfully, but these errors were encountered: