Skip to content

Better strategy for dealing with svg #147

@Swatinem

Description

@Swatinem

I had a hunch and the failing test I just commited (83e9ed9) proves it:
When using components to render children into a svg node, the children get the wrong namespace.

Looking at other frameworks, react and incremental-dom both rely on the parent element to determine which namespace to use for elements:
https://github.com/facebook/react/blob/master/src/renderers/dom/stack/client/ReactDOMComponent.js#L511-L533
https://github.com/google/incremental-dom/blob/master/src/nodes.js#L30-L40

Problem is that since we separated create from mount, we can’t really look at any parent at creation time. I think I also saw that some frameworks keep whitelists of svg tags, so that might be an option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions