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

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-cascade-4][css-syntax-3] *Fetch `@import`* should *create a CSS style sheet* ==
I believe steps 3.4-7 of [fetch `@import`](https://drafts.csswg.org/css-cascade-4/#fetch-an-import) should be replaced with something similar to this:

  > 4. Let `rules` and `encoding` be the result of [decode](https://drafts.csswg.org/css-syntax-3/#css-decode-bytes) with `response` and `rule`.
  > 5. [Create a CSS style sheet](https://drafts.csswg.org/cssom-1/#create-a-css-style-sheet) with the following properties:
  >
  >    - **encoding**: `encoding`
  >    - **location**: the result of [resolving](https://drafts.csswg.org/css-values-4/#resolve-a-style-resource-url) `rule`'s URL with `ruleOrDeclaration`
  >    - **media**: the [media](https://drafts.csswg.org/cssom-1/#concept-css-style-sheet-media)'s [`mediaText`](https://drafts.csswg.org/cssom-1/#dom-medialist-mediatext) attribute of `rule`
  >    - **origin-clean flag**: true if `response` URL has [same-origin](https://html.spec.whatwg.org/multipage/browsers.html#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](https://drafts.csswg.org/css-syntax-3/#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](https://drafts.csswg.org/css-syntax-3/#css-decode-bytes) 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`.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13049 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 1 November 2025 07:15:08 UTC