Skip to content
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

Can't Render SVG #170

Closed
sdmcallister opened this issue Jan 12, 2021 · 4 comments
Closed

Can't Render SVG #170

sdmcallister opened this issue Jan 12, 2021 · 4 comments
Labels

Comments

@sdmcallister
Copy link

I've tried without success:

proc createDom(): VNode =
  result = buildHtml(tdiv):
    svg(width = "100", height="100"):
      circle(cx="50", cy="50", r="40", stroke="green", stroke-width="4", fill="yellow")
      text "Doesn't Support SVG"

Everything compiles fine with no errors amd I can see the Element in the Browser developer mode, but the image doesn't render and I see the text. On on the latest version of Chrome.

@sdmcallister
Copy link
Author

This seems to work:

tdiv:
  verbatim """<svg width=100 height=100>
                        <circle cx=50 cy=50 r=40 stroke=green stroke-width=4 fill=yellow />
                      </svg>"""

@planetis-m
Copy link
Contributor

Same with firefox

@planetis-m
Copy link
Contributor

planetis-m commented Feb 4, 2021

So the problem is empty tags, browser prefer self closing tags in that case. They need to be created with createElementNS

@ajusa ajusa added the bug label May 2, 2021
@geotre geotre mentioned this issue Mar 2, 2023
@geotre
Copy link
Collaborator

geotre commented Oct 20, 2023

SVG support added in #271

@geotre geotre closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants