Skip to content

Support for Element.namespaceURI ("SVG support") #189

Description

@kyr0

Hi :)

one small feature request: In case I'm not missing something, the namespaceURI attribute on Element is not set when const el = document.createElementNS("http://www.w3.org/2000/svg", virtualNode.nodeName) is called?

https://dom.spec.whatwg.org/#ref-for-dom-element-namespaceuri%E2%91%A0

I'm rendering JSX via linkedom and I realized that my unit tests were failing with the SVG elements compared to JSDOM. When creating elements using const el = document.createElementNS(SVG_NAMESPACE, virtualNode.type) the namespaceURI doesn't end up being present in el.namespaceURI. This is a bit unfortunate, because in case of SVG, the elements/attributes, such as xlink:href etc. should all be created/set using the setAttributeNS etc. method invariants, but I can't simply check the parent if the namespace is set to decide if I use the NS invariants, because the parentNode doesn't remember its namespaceURI. I could of course hack something in my code as a remedy, but I'd prefer if it was just behaving a little bit more standard compliant here (if I'm not mistaken) :)

Thanks alot and best!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions