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

Namespace-correct SVG attributes? #8

Closed
mbostock opened this issue Dec 19, 2019 · 2 comments · Fixed by #23
Closed

Namespace-correct SVG attributes? #8

mbostock opened this issue Dec 19, 2019 · 2 comments · Fixed by #23

Comments

@mbostock
Copy link
Member

Similar to #7, there are a few attributes that have implicit namespaces in SVG.

Attribute name Prefix Local name Namespace
xlink:actuate xlink actuate XLink namespace
xlink:arcrole xlink arcrole XLink namespace
xlink:href xlink href XLink namespace
xlink:role xlink role XLink namespace
xlink:show xlink show XLink namespace
xlink:title xlink title XLink namespace
xlink:type xlink type XLink namespace
xml:lang xml lang XML namespace
xml:space xml space XML namespace
xmlns (none) xmlns XMLNS namespace
xmlns:xlink xmlns xlink XMLNS namespace

In order to do this, we’d need to track whether we’re in the SVG namespace, because it should only apply to SVG elements.

@luwes
Copy link

luwes commented Jan 31, 2020

Cool project! I've been following HTM for a while and created an implementation on top of it for Sinuous. Related to this issue, is this comment still accurate?

HTM’s approach would also need to be adapted for contextual namespaces, such as SVG, since it creates content bottom-up

It creates content bottom-up but you'll need to define the namespace either way I think, unless you create a tag name mapping of some sort which is gonna be pretty big. Or is there a way to detect this cheaply?

@mbostock
Copy link
Member Author

mbostock commented Jan 9, 2021

@luwes Thanks. When in the HTML namespace (which is the assumed namespace when you use the html tagged template literal) only the <svg> element opens a scope for the SVG namespace; you don’t need to know all the names of SVG elements.

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

Successfully merging a pull request may close this issue.

2 participants