linkedom
linkedom copied to clipboard
HTMLSlotElement.assignedNodes()
Currently HTMLSlotElement.assignedNodes()
doesn't seem to be supported, I have a couple of components that I'd like to SSR that make use of this API. Do you think assignedNodes()
could at some point be supported?
ShadowDOM is still not SSR friendly… once it is, stuff related to SSR will land, in a way or another, but so far I never cared about ShadowDOM even on the client side (it’s not needed) so don’t expect much to work.
PRs welcome though 👍
so don’t expect much to work.
Most of the custom elements ive SSRed that use shadow dom seem to work fine 🙂 Im just missing assignedNodes on the slot element
Ill try and see about making a PR, thanks
DSD is not out though, or is it? That’s what I meant (Declarative ShadowDOM)
Hmm I was hoping that this would only be a small change to HTMLSlotElement
by adding the assignedNodes()
method, but it looks like this.shadowRoot.querySelector('slot')
doesnt actually return a HTMLSlotElement
, but an Element
, and it seems like all elements have the same nodeType
. Im not sure if I'll be able to contribute that
@thepassle sorry for late reply ... you need to register special elements otherwise these are created as Element instances ... see any registered element to understand how that's done, the Options is the latest that got added: https://github.com/WebReflection/linkedom/commit/155dfb9de84c672a0b2f4476d14f68d4b9a5054e
added this to my branch https://github.com/WebReflection/linkedom/compare/main...luwes:linkedom:wesc?expand=1#diff-5ade2633056d4de7ec79588b01256021baa9de705796a309e7cfda73e9b25d7d
let me know if you're interested, I can open a PR
haven't checked but as I don't care/need Shadow DOM too much and it's not (I hope) on any critical perf path, feel free to open that PR, thanks!
That would still be helpful to me @luwes , so id be very appreciative if you could make that PR :)
I would love to have this as well. It is impossible to use custom elements without needing ShadowDOM. If you do composition in any other framework (props.children in React/Preact/Solid, slots in Vue/Svelte, etc), then you need ShadowDOM for the same (highly useful!) patterns with custom elements.
Folks I’m afraid life happens and extra time for stuff I don’t need/use daily, even for reviews I’d love to merge, is super hard to find. I’ll do my best to follow up on this whenever I can put my brain and eyes on it, and as ETA that’s not likely going to happen before the end of the month, but I’ll try any weekend I can.
@WebReflection
Could please take a look at the already provided PR (#209) for this issue.
IMHO it's a very important improvement, because many of us want to utilize linkedom
mainly for SSR rendering of Custom Elements and all its horrible obstacles in a sufficient standard compliant manner.
Sure, there are other workarounds possible and few forks including this patch are also available. Nevertheless. I would highly appreciate a more proper solution, which keeps bug reports, continuous improvements and reliable maintenance at solely one well known place together.
I'm still very busy ... I'll try to merge after review some PR over the weekend
... I'll try to merge after review some PR over the weekend
Thank you for your pleasant reply!