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

How does access to .cssRules behave before the sheet is "done loading" #11

Closed
bzbarsky opened this issue Feb 6, 2018 · 7 comments
Closed

Comments

@bzbarsky
Copy link

bzbarsky commented Feb 6, 2018

E.g. before all the @imports have finished. Does it throw? Does it allow mutation of the rule list while loads are still in progress? Something else?

@calebdwilliams
Copy link

In the web components issue 468, @rniwa proposed disallowing @import in the constructible stylesheet spec. Not sure what the pros and cons are of that, but just trying to connect some dots.

@bzbarsky
Copy link
Author

bzbarsky commented Feb 22, 2018

Disallow in what sense? Not parsed (i.e. dropped from the rule list)? Throws? Not loaded? Something else?

@calebdwilliams
Copy link

calebdwilliams commented Feb 22, 2018

Not sure, like I said, just trying to connect some dots. For that particular issue, was hoping we would be able to fetch an external resource for customElements styles, but looks like @annevk agreed. Maybe someone should add this as a separate issue for discussion? I'm not sure I'm qualified to have any real opinions here, just wanting to see the thing move froward.

@annevk
Copy link

annevk commented Feb 22, 2018

FWIW, I think this should work the same way as <link rel=stylesheet> or <style> deal with it, though as I noted in #21 we should maybe define those properly first.

@TakayoshiKochi
Copy link
Member

Let me close this as #25 concludes we disallow @imports.

@TakayoshiKochi
Copy link
Member

From the discussion at whatwg/html#2997 (especially from Tab's whatwg/html#2997 (comment)), conceptually the sheet is parsed atomically, and therefore when <link rel=stylesheet> or <style>'s .sheet is available, its .cssRules is also available.

For this spec, the constuctor will produce a CSSStyleSheet with empty rules, and for the factory method, it returns a promise and once it resolves, its return value (a new CSSStyleSheet object) should have .cssRules ready.

So let's not make a CSSStyleSheet object visible until its all dependent loading/parsing is done.

(basically this adds nothing to what @annevk already said above)

@rakina
Copy link
Member

rakina commented Aug 30, 2018

Closed with #33 (like the above comment says, we aren't resolving Promise until it's done loading)

@rakina rakina closed this as completed Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants