Closed kyr0 closed 1 year ago
This project is about SSR, not unit tests, so anything non SSR related has zero to low priority but this seems to be a generic valid expectation so I'll try to have a look but I have really little time these days and looking for a new job while being daddy 24/7 so ... PR welcome, otherwise I am afraid it might take a while as nobody is sponsoring this project.
I see, yeah.. that's a lot on your side... and I hope that you'll find a great new job very soon. I'll see if I can craft a PR :) Also, my other PR is stale since 2021 xD https://github.com/WebReflection/linkedom/pull/96 but I recently had another idea on that.. maybe, maybe I'll find the time and energy to continue there too.
Btw, in my case I have an isomorph DOM renderer abstraction that is passed a Document
to work with. So it's pretty agnostic in what it receives. Can be linkedom
, a JSDOM
or a native Document
-- doesn't matter.
Now the Unit Tests weren't happy in SSR rendering with linkedom
serialized HTML result as the namespaced attributes didn't look right (they weren't transformed from JSX xlinkHref
to xlink:href
) and that was because my code didn't run into the if
condition that checks for that el.namespaceURI
. Because of the isomorphic nature, I'd love to keep the code exactly the same - as it behaves standards compliant.
I think that will be a pretty easy fix so I'll def. try today :) I think I remember this codebase pretty well :)
my other PR is stale since 2021
hooking this project into an abandoned proprietary standard is possibly out of scope ... I have recently proposed myself ESX and that might be more in my interests to make it happen, although ESX doesn't require me to do anything here, so that's a plus 😅
hooking this project into an abandoned proprietary standard is possibly out of scope
Fair enough :) Interesting thoughts on ESX!
I went ahead and fixed this issue with the most sensible and minimal change, I hope that's OK.
Hi :)
one small feature request: In case I'm not missing something, the
namespaceURI
attribute onElement
is not set whenconst 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 usingconst el = document.createElementNS(SVG_NAMESPACE, virtualNode.type)
thenamespaceURI
doesn't end up being present inel.namespaceURI
. This is a bit unfortunate, because in case of SVG, the elements/attributes, such asxlink:href
etc. should all be created/set using thesetAttributeNS
etc. method invariants, but I can't simply check the parent if the namespace is set to decide if I use theNS
invariants, because theparentNode
doesn't remember itsnamespaceURI
. 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!