Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification for <link> behavior in Declarative Shadow DOM #9232

Open
bakura10 opened this issue Apr 19, 2023 · 3 comments
Open

Clarification for <link> behavior in Declarative Shadow DOM #9232

bakura10 opened this issue Apr 19, 2023 · 3 comments
Labels
topic: link topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@bakura10
Copy link

bakura10 commented Apr 19, 2023

Hi :),

I'm playing with Declarative shadow dom and found that, if a stylesheet is loaded inside a declarative shadow DOM template, the rendering is blocked. Safari (that also implement declarative shadow DOM) however does not block rendering, which causes a FOUC.

I have been unable to find any note in the specification on which behavior is correct. It would be nice for the stylesheet to be blocking. For now, the only way to avoid the FOUC is to also load the stylesheet at the global scope, but the issue with this approach is that it leaks the style to the main document, which is indesirable.

Thanks.

@annevk annevk transferred this issue from whatwg/dom Apr 28, 2023
@annevk annevk added topic: shadow Relates to shadow trees (as defined in DOM) topic: link labels Apr 28, 2023
@annevk
Copy link
Member

annevk commented Apr 28, 2023

Looking at https://html.spec.whatwg.org/#contributes-a-script-blocking-style-sheet and #5465 this would constitute a bug in Chromium, though it does seem somewhat logical to update the

The last time the event loop reached step 1, el's root was that Document.

check.

cc @rniwa @mfreed7

@bakura10
Copy link
Author

bakura10 commented Dec 6, 2023

Hi,

Do we have any information on what is the expected behavior, after all? The way Safari does it quite counter-intuitive, it would be very useful to at least have a clarification in the spec here (Chrome still blocks the rendering as of December 2023, which is nice for avoiding CLS issue).

@mfreed7
Copy link
Collaborator

mfreed7 commented Jan 8, 2024

I'm playing with Declarative shadow dom and found that, if a stylesheet is loaded inside a declarative shadow DOM template, the rendering is blocked. Safari (that also implement declarative shadow DOM) however does not block rendering, which causes a FOUC.

I think this is likely just inadvertent behavior in Chromium. Having said that, it does sound like a nice bit of behavior, to avoid the FOUC issue as you mentioned. I'd be supportive of a spec change to make that the official behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: link topic: shadow Relates to shadow trees (as defined in DOM)
Development

No branches or pull requests

3 participants