-
-
Notifications
You must be signed in to change notification settings - Fork 148
Need to transform camelCased svg attributes to kebab-case for SVG elements to display properly #222
Comments
In case you needed a map, here is a list of all kebab-cased svg attributes (not there are some camelCased attributes in SVG, so you can't just translate all camelCased attributes in svg nodes to kebab-case). React doesn't support all svg attributes, but if you map this list below to kebab-case equivalents, then you should be OK as a superset of what you would ever see from React. https://facebook.github.io/react/docs/tags-and-attributes.html accent-height or as a map: |
React camelCases all but the data-* and aria-* html attributes, including on SVG elements: https://facebook.github.io/react/docs/dom-differences.html.
preact-compat nor preact-svg do not translate any React camelCased attributes to htmls kebab-case. This isn't a problem with normal html elements, as there are only a couple,
accept-charset
for<form>
elements andhttp-equiv
for the<meta>
elements. It's unlikely preact/React would be used in the meta tag, but http-equiv in form might be used. Could be something to look into.However, the bigger issue is svg which has lots of kebab-cased attributes based on CSS properties (e.g.
strokeWidth => stroke-width
). React svg code simply won't style properly as-is without transforming these to dash-case.The text was updated successfully, but these errors were encountered: