Skip to content

[css-cascade-4][css-syntax-3] *Fetch @import* should *create a CSS style sheet* #13049

@cdoublev

Description

@cdoublev

I believe steps 3.4-7 of fetch @import should be replaced with something similar to this:

  1. Let rules and encoding be the result of decode with response and rule.

  2. Create a CSS style sheet object with the following properties:

    • encoding: encoding
    • location: the result of resolving rule's URL with ruleOrDeclaration
    • media: the media's mediaText attribute of rule
    • origin-clean flag: true if response URL has same-origin as location, otherwise false
    • owner CSS Rule: rule
    • parentStyleSheet: rule's parent style sheet
    • rules: rules

encoding should be a CSSStyleSheet state item because it is required as the environment encoding, if no other encoding has been defined otherwise (BOM, @charset, Content-Type):

The environment encoding of an imported style sheet is the encoding of the style sheet that imported it.

Since decode resolves the "final" encoding used, it should probably be included in its return value.

rules could also be byte stream or response instead. This is an implementation detail.

origin-clean flag should be defined depending on whether response has same-origin instead of CORS-same-origin as the rule's URL. See #12288.

I may be missing other state items. Perhaps title should be rule's parent style sheet title.

edit: removed use of create a style sheet since @import-ed style sheets are not included in document stylesheets.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions