-
Notifications
You must be signed in to change notification settings - Fork 92
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
Compiling in js app changes case of attribute #100
Comments
That could be fixed, although is Safari the one doing it wrong: https://www.w3.org/TR/html51/syntax.html#writing-html-documents-elements
Also:
PD: this problem is all around the net |
Agreed, it is a problem all around and the HTML standard is that attributes are case-insensitive. However, it appears that the SVG standard is to use case-sensitive attribute names. From https://w3c.github.io/svgwg/specs/svg-authoring/
From https://www.w3.org/TR/SVG11/styling.html
It really does appear that the SVG designers used a mixture of styles with defining attributes. It's a mess, but it is what it is. |
Well ok, how do we fix it? |
Personally I would like to see the following transformations supported (and consistent between c and js compilers): svg(wiDTH = "16", HeiGht = "16, `viewBox` = "0 0 16 16", `data-foo` = "2", `data-BaR` = "7") Turns into <svg width="16" height="16" viewBox="0 0 16 16" data-foo="9" data-BaR="7"> Essentially all attribute names are made lowercase except when they are within backticks. Within backticks, attribute names are kept as is without any transformation. Any names in kebab case (eg. I think this should be applied to all HTML and SVG elements so there wouldn't need to be special case rules for one versus the other. |
I'm trying to generate some svg and I'm seeing a small difference if I render it in a javascript app versus rendering it on the server.
Now if I render it on the server, it comes out as expected:
However, if I use it in a javascript app as a
VNode
, then it comes out with theviewBox
attribute changing to be all lowercase.This small change seems to break the svg in the Safari browser. The result is that the browser gives it a height and width of 0 so you can't see it.
My workaround so far has been to generate the svg as an html string and use a
verbatim
tag to insert it directly.The text was updated successfully, but these errors were encountered: