Re: [csswg-drafts] [mediaqueries-4] Need to describe how to serialize <general-enclosed> in mediaqueries. (#7266)

I repeat my point in #8735 (now closed) on serializing exactly as specified by the author.

  > Preserving a trailing comment before the ending token of a simple block, eg. `@supports (width: 1px /* comment */)`, is also incompatible with the current tokenization algo, because it can only be part of the representation of the ending token (`)`): the algo repeatedly consume a token by consuming any comments before consuming following code point(s).

One solution I see would be to consume a run of comments or whitespaces before and after consuming a token, except after opening/ending tokens.

But this is not my preferred solution to serialize `<declaration>` and `<any-value>` (`<general-enclosed>`) because I think it is only required to not serialize `--id: 1e0-foobar` as `--id: 1-foobar`, ie. for `<declaration-value>` (related: #6484).

Consuming runs of whitespaces when parsing `<any-value>` and `<declaration>` would simplify serizalization with tokens. For example, `var(--custom , /**/ 1 )` to `var(--custom, 1)`.

Now there seems to be some beginning of cross-browser compat, to serialize exactly as specified, so I do not know.

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


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

Received on Monday, 24 April 2023 19:25:09 UTC