Re: [csswg-drafts] [multiple] Serialization of rules (#4828)

> **CSSImportRule**
>
>The result of concatenating the following:
> 1. The string `@import` followed by a single SPACE (U+0020).
> 2. The result of performing serialize a URL on the rule’s location.
> 3. If the rule’s associated media list is not empty, a single SPACE (U+0020) followed by the result of performing serialize a media query list on the media list.
> 4. The string `;`, i.e., SEMICOLON (U+003B).

Serializing `@import` currently requires serializing its location as an `<url>` (even when specified as a `<string>`) and serializing its *associated media list* with *serialize a media query list*, but `CSSImportRule` does not have a property that is a list of component values matching `<media-query-list>`.

I tested in Chrome/Firefox, and both seem to use `CSSImportRule.media`, which is a live reference to `CSSImportRule.styleSheet.media`, meaning it may not correspond to the value authored in the style sheet for `@import` if it has been updated with `CSSImportRule.styleSheet.media.mediaText` or `CSSImportRule.styleSheet.media.appendMedium()`. Also note that currently there is nothing preventing the media list from being updated, while you can't update the imported style sheet rules.

Suppose that you specify `supports(display: unsupported)` as an import condition (supports condition in `@import` do not seem to be already supported in Chrome/Firefox, which parse/serialize it to `not all`), then UA *must return null for the import rule’s `CSSImportRule.styleSheet` value*. Obviously, I should I keep/use an internal reference to the prelude value authored in the style sheet for `@import`.

Please let me know if you think there is anything wrong/unexpected regarding my observations.

-- 
GitHub Notification of comment by cdoublev
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4828#issuecomment-1059910651 using your GitHub account


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

Received on Sunday, 6 March 2022 07:24:56 UTC