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

SVG Support? #81

Open
apowers313 opened this issue Jan 2, 2022 · 2 comments
Open

SVG Support? #81

apowers313 opened this issue Jan 2, 2022 · 2 comments

Comments

@apowers313
Copy link

I'm trying to use d3 for SSR. The most likely path to success is to d3's SVG, but when I try to do this with deno-dom I run into an error that SVG namespaces are unimplemented.

Would this be something quick and easy to implement?

@b-fuze
Copy link
Owner

b-fuze commented Jan 2, 2022

No, it won't be quick and easy unfortunately. There are quite a few things to consider before implementing SVG properly in Deno DOM, for example, having an actual XML parser. You can probably get by via silencing that error... Though that is not a solution, and Deno DOM will not distinguish between SVG and HTML elements as it should.

Hopefully soon I can get around to making this work, but at the time being Deno DOM is limited to only processing HTML content.

@andreubotella
Copy link
Contributor

andreubotella commented Jul 25, 2022

There is some level of support for SVG that deno-dom could have without (before) having to implement a full-on XML parser. For example, the HTML syntax supports embedded SVG, and it will give such elements the SVG namespace. IIRC this is implemented in html5ever, the HTML parser that deno-dom uses, except that currently deno-dom ignores the namespace – once it supports namespaces, supporting SVG embedded in HTML would be trivial to implement. And for simple SVG documents in the XML syntax, parsing them as HTML and doing document.querySelector("svg") might go a long way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants