-
Notifications
You must be signed in to change notification settings - Fork 598
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
fix: SVG elements (text and shapes) in the repeat directive are not rendered by the browser #6599
Comments
This may be browser limitation since svgs are not actually html but an xml syntax. This needs more investigating to know for sure. |
Thanks for the quick response @KingOfTac. Here's a short snippet for reference that generates a dynamic SVG in native JS, and highlights the difference between createElementNS and createElement
dynamic-svg-elements-native-js.mov |
Some insight into what is going on under the hood here, we are creating a This is still an issue we will address in future, however it's not high on the priority list. If you'd like to propose and contribute a fix I would suggest the creation of an |
🐛 Bug Report
When trying to render SVG elements (text and shapes) from within the
repeat
directive, the nodes are present in the DOM but they are not rendered by the browser. Elements outside of therepeat
directive are correctly rendered.The following two screenshots highlight some of the differences between the working element (from outside the
repeat
directive) and a non-working element (from inside therepeat
directive):tagName
andnodeName
of the elementsWorking element:
Non-working element:
💻 Repro or Code Sample
https://stackblitz.com/edit/node-nszhmz?file=src%2Fjs%2Ftag%2Ftag.ts,src%2Ftemplates%2Findex.html,src%2Fjs%2Ftag%2Ftag.ts&v=1
🤔 Expected Behavior
SVG elements are rendered as expected
😯 Current Behavior
SVG element DOM nodes are present in the DOM but not recognized/rendered by the browser
💁 Possible Solution
Might have something to do with SVG namespaces. Attributes in SVG elements might need to be set with
setAttributeNS
instead ofsetAttribute
. There are several somewhat similar issues on StackOverflow and other forums that point to namespaces as a potential issue.🔦 Context
FAST components don't seem to be able to dynamically render SVG elements from the
repeat
directive. Reproduced in Chrome, Firefox (locally + stackblitz) and Safari (locally).🌍 Your Environment
The text was updated successfully, but these errors were encountered: