svelte: generates proper html but doesn't get rendered properly.
Describe the bug
I am using a python library that builds a json describing the html components. This is then fed to a svelte code that uses svelte:element to instantiate the html components. All components (button/iinput) works fine except for svg elements. The html is generated properly as shown below
<button value="9" class="...." style=""> <svg viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" class="h-6 w-6" style=""> <path stroke-linecap="round" stroke-linejoin="round" d="M9 5l7 7-7 7" style=""> </path></svg></button>```
however the svg doesn't gets rendered on the screen (the button does though)
### Reproduction
Kind of tricky for this case to build a reproduction. If really needed, I can try. Let know.
### Logs
_No response_
### System Info
```shell
System:
OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (4) arm64 Cortex-A72
Memory: 2.39 GB / 3.68 GB
Container: Yes
Shell: 5.1.4 - /bin/bash
Binaries:
Node: 18.3.0 - /usr/bin/node
npm: 8.11.0 - /usr/bin/npm
Browsers:
Firefox: 91.10.0esr
npmPackages:
svelte: ^3.48.0 => 3.48.0
Severity
annoyance
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 19 (7 by maintainers)
I came across something I believe is similar to this issue.
I’m doing something like this:
App.svelte
DynamicTag.svelte
The html generated and retrieved through the browser developer tools is flawless and will work if used statically, but renders nothing within my svelte app. The DynamicTag component will work for any non-svg tag, or if svelte:element isn’t used (but that’d defeat the purpose obviously).
TLDR Not really having looked into this much, my guess would be that Svelte underneath creates the element using document.createElement and g, along with all other svg tags, only work when created with document.createElementNS.