- From: Joe Pea <notifications@github.com>
- Date: Tue, 07 Jul 2020 18:58:18 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/510/655234266@github.com>
> @prlbr yes, but there are enough tricky questions about how this should be behave that it seems like we should see more user-space solution uptake in the wild. There's not so much that the browser can do here that can't be done with a very small script and `<template>`. I think if someone vended a library for this and it got uptake it might have a better chance of a comeback.
>
> The code should be very simple, something along the lines of:
>
> ```js
> for (const template of document.querySelectorAll('template[shadowroot]')) {
> try {
> const mode = template.getAttribute('shadowroot');
> const root = template.parentElement.attachShadow({mode});
> template.remove();
> root.appendChild(document.adoptNode(template.content);
> } catch (e) {
> console.error(e);
> }
> }
> ```
@caridy pretty much summed up what I also thought about @justinfagnani's idea.
There are so many custom element libs out there (and there will be more and more), that we can't reliably expect them to all follow any non-standard standard. F.e. One custom element works with one SSR lib, another custom element only works with a yet a different SSR lib, etc. Things just won't work well.
As an application author, we may be able to choose a certain set of custom elements that work with a certain SSR implementation, but now we're back in the same boat as having to choose between React, Angular, Vue, Svelte. If I can't use _all_ custom elements reliably and I have to choose only certain ones, I may as well choose any other non-custom-element framework and thus custom elements aren't winning.
An official solution will be wonderful.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/510#issuecomment-655234266
Received on Wednesday, 8 July 2020 01:58:31 UTC