- From: Mason Freed <notifications@github.com>
- Date: Wed, 03 Feb 2021 19:29:26 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/831/773000616@github.com>
> This isn't true, it only has the same limitations the existing non-declarative Shadow DOM (via `.attachShadow`) has. If you can polyfill Shadow DOM then you can polyfill DSD fairly trivially on top of it†. Whether or not something breaks backwards compatibility is purely based on whether polyfilled Shadow DOM will break backwards compatibility for your use case. I think this is generally the right answer here. This feature is merely a declarative form of something that already existed (`.attachShadow()`). If your site is already using Shadow DOM, or if you want to move to using Shadow DOM, this feature will allow your site to be compatible with SSR. As for polyfills or backwards compatibility, I actually don't think it's that big of an issue. As mentioned, this feature does have a reasonably simple polyfill. I show a simple one [here](https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md#feature-detection-and-polyfilling) in the explainer, and I talk about some different polyfill approaches and their performance tradeoffs [here](https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md#performance). But for the typical Custom Element use case, you could also just **not** polyfill this feature at all. For browsers that don't support DSD, as mentioned, the `<template shadowroot>` content will be invisible, because it is inside a `<template>`. Once the custom element code is loaded, and the elements upgrade, they will (as they do already) attach their shadow root and set up the contents. They just won't get the FCP/LCP benefit of the SSR content in that case. TL/DR: I agree with this statement: > Yes, if you're not using Shadow DOM, then there's not really any reason to use DSD. DSD is effectively just a declarative form of `.attachShadow(...)` with a couple tweaks to make it work nicely with existing `.attachShadow` calls. -- 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/831#issuecomment-773000616
Received on Thursday, 4 February 2021 03:29:42 UTC