Re: [WICG/webcomponents] "open-stylable" Shadow Roots (#909)

> The original idea (this.attachShadow({mode: 'open-stylable'});) would cause FOUC.
> 
> Why is that necessarily the case? This is a script necessary for rendering. Loading such a script after rendering will casuse FOUC, loading it before will not.
> 
> This would also work with declarative shadow DOM which does not require script and is therefore not likely to FOUC.
> 
> `<div>`
>   `<template shadowrootmode="open-stylable">...</template>`
> `</div>`

attachShadow() is not necessary in the first place for rendering a declarative shadow tree; even a Custom Element can have a shadow root before it gets upgraded. 

That's why declarative shadow DOM works for server side rendering while also providing built in opt-in (in the shadow layers proposal) for Custom Element authors. And is polyfillable.

So no new mode is needed for either standalone shadow trees (or Custom Elements that opt-in).  To me, FOUC-free is both necessary and achievable.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/909#issuecomment-1997987689
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/909/1997987689@github.com>

Received on Thursday, 14 March 2024 17:35:39 UTC