3 ms·
Where is this "alleged" though? From one of the paragraphs behind my link: > This won't appear in your page until you grab a reference to it with JavaScript an
by mariusor 2y ago
Where is this "alleged" though? From one of the paragraphs behind my link:
> This won't appear in your page until you grab a reference to it with JavaScript and then append it to the DOM
- debugnik 2y agoYour link isn't showing the declarative shadow DOM, this does: https://web.dev/articles/declarative-shadow-dom#how_to_build_a_declarative_shadow_root https://web.dev/articles/declarative-shadow-dom#how_to_build... And the example below that one shows how to hydrate declarative shadow roots with JS custom elements, so the path to progressive enhancement should be clear. I say alleged because I haven't had the chance to try it beyond a toy example.
- mariusor 2y agoI'm not sure what you meant when you said "without JS". To actually use templates you need JS. Yes you can declare them, but what's the point?
- debugnik 2y agoYou've ignored the part where the declarative template is immediately attached to its parent as a shadow root by the parser, and its siblings become the slot children. You don't need to instance or register anything with JS there, just copy-paste the template (admittedly lame, but kinda the same repetition as SSR today, just less involved and with a shadow root).