Skip to content

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

Closed

Description

@bzbarsky

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?

Activity

  1. calebdwilliams commented on Feb 21, 2018

    @calebdwilliams

    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.

  2. bzbarsky commented on Feb 22, 2018

    @bzbarsky
    Author

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

  3. calebdwilliams commented on Feb 22, 2018

    @calebdwilliams

    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.

  4. annevk commented on Feb 22, 2018

    @annevk

    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.

  5. TakayoshiKochi commented on May 22, 2018

    @TakayoshiKochi
    Member

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

  6. TakayoshiKochi commented on Jul 6, 2018

    @TakayoshiKochi
    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)

  7. rakina commented on Aug 30, 2018

    @rakina
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions