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
When using the Element API I want to be able to create SVG elements #2842
Comments
Previously discussed in #1097. Not sure if the namespace is still an issue also |
This SO answer about HTML5 is very enlightening: https://stackoverflow.com/a/23322429/1006669
Plus:
So it seems like the Element API does not need any special handling of namespaces, it should just respect the right case for some SVG attributes and tags (MathML already has all lower-case attributes/tags). |
This is a comprehensive index of all SVG attributes and elements where they may appear: |
As a workaround, you could try creating a regular element as a wrapper, and then do |
Any update on this? As far as i understand the problem its caused by the way nodes and attributes are created on the client side (JavaScript): document.createElement("svg"); If the element would be created by calling Same thing about adding attributes: |
I got the same problem. Thank you. |
|
Still looking for a solution :) |
Any news on this? |
For me it seems that this is related to: Setting the outerHTML-Attribute "as it is actually" via javascript renders the svg correctly.
|
Any news? I would be interested as well. |
There has been quite many requests for SVG support, but this is not currently very high on our TODO list. I'd love to learn more about the needs so I could prioritise this properly.
|
A quite straight forward way is to create the SVG using |
OK I just lost almost a day over this bug. I was using the |
We could even go one step further. We're already parsing the HTML on the server so we could explicitly look for usage of |
@Legioth I really have not the insight and knowledge about this, but could we not even find someone to actually make it work :) |
Well maybe it's better just to support it (2022 already), rather than throw an exception |
I created a draft PR to add trivial SVG support to Html, but only read-only: #15539. For that use case it might be though better to create a separate Svg component. A proper support via Element API (as I think @heruan originally ment in this issue) would be great as well, would help to create some more advanced components. |
Also drafted the Svg component idea: #15540 |
Status update: The master branch now contains Svg component to display images (and to allow styling them with css), but Element API still don't support SVG. There is a start by @Legioth to fix this actual issue, but we'd still need to get rid of attribute name lowercasing (or some other workaround if we want to make the framework more complicated than would be required ;-) ): 9472e95 |
When creating components with the Element API I want to be able to create simple SVG elements, so I do not have to include other files and I can keep my source tree clean.
The Element API enforces attribute names to be lower case, but with SVG elements this may cause trouble since browsers are picky on SVG attribute case, e.g. Chrome won't render an
<svg>
with attributeviewBox
written all lowercase.This prevents creating SVG elements with the Element API, while a developer would expect to be able to do so in HTML5 documents e.g. as shown in MDN SVG element reference.
The text was updated successfully, but these errors were encountered: