You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How does access to .cssRules behave before the sheet is "done loading" #11
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.
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.
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.
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)
Activity
calebdwilliams commentedon Feb 21, 2018
In the web components issue 468, @rniwa proposed disallowing
@importin the constructible stylesheet spec. Not sure what the pros and cons are of that, but just trying to connect some dots.bzbarsky commentedon Feb 22, 2018
Disallow in what sense? Not parsed (i.e. dropped from the rule list)? Throws? Not loaded? Something else?
calebdwilliams commentedon 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
customElementsstyles, 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 commentedon 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 commentedon May 22, 2018
Let me close this as #25 concludes we disallow
@imports.TakayoshiKochi commentedon Jul 6, 2018
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.sheetis available, its.cssRulesis also available.For this spec, the constuctor will produce a
CSSStyleSheetwith empty rules, and for the factory method, it returns a promise and once it resolves, its return value (a newCSSStyleSheetobject) should have.cssRulesready.So let's not make a
CSSStyleSheetobject visible until its all dependent loading/parsing is done.(basically this adds nothing to what @annevk already said above)
rakina commentedon Aug 30, 2018
Closed with #33 (like the above comment says, we aren't resolving Promise until it's done loading)