-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codemod for SVG Attributes #6213
Comments
Relevant React PR: #5714 |
SVG has equivalents for these on the style object. I think that's the direction SVG is intending to go to unify the style models with HTML/CSS. Shouldn't we recommend that both |
Not for the kebab-case attributes that aren't styles, for instance |
Pretty sure SVG fonts isn't supported cross browser anyway. Don't expect that one to be used. Mostly edge cases. Is there a common one? I think commonality and things that are passed down through spread or forwarding properties (e.g. className) are the most important to get right. An edge case for a little used attribute is better if we can keep the rest consistent. |
I don't know what's commonly used and what isn't; I read the spec to understand, and the spec doesn't mention popularity metrics :). But I disagree with your supposition that it's better to remain consistent with a crappy API than to avoid edge cases (past, present, and future). IMO, It would be better to "fix" the legacy API decisions. Regardless, there are at least 71 SVG attributes with kebab case today, and more may be introduced in the future. I think it's better to remain consistent with the SVG API and pass everything through, rather than introduce special edge cases every time something pops up. Passing everything through is easy to understand, conforms to the spec, and will future proof us against future changes in the spec and an ever-growing whitelist - it is clearly the better route, IMHO. |
They're not mutually exclusive. We can still recommend using the style object instead of attributes. That way the recommendation is still camel case.
|
I think that I disagree about Likewise, the The web is going AWAY from the serialized form to prefer rich complex data types. E.g. CSSOM moving to value objects for color, lengths, etc. instead of just strings. By clinging to attributes we're actually encouraging legacy. The only thing I wish we did was call it |
The point of the codemod would be to get rid of warnings, not necessarily move everything to Let's do it and put it in https://github.com/reactjs/react-codemod |
If you think that's an easier story, sure. We should make a blog post about it at least though. Not sure about deprecating |
Previously, the whitelist of supported SVG attributes was very incomplete. Rather than constantly playing catch up with the SVG attributes whitelist, we decided it would be better to pass all attributes directly through. For example, the
strokeWidth
attribute is now deprecated in favor of thestroke-width
attribute (the "standard" attribute for SVG elements).It would be good if we had a codemod to help SVG users migrate to v15. It can rewrite all the known attributes (including
className
->class
for SVG elements).The text was updated successfully, but these errors were encountered: