Skip to content

[mediaqueries-4] Need to describe how to serialize <general-enclosed> in mediaqueries. #7266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dbaron opened this issue May 10, 2022 · 2 comments
Labels
cssom-1 Current Work mediaqueries-4 Current Work

Comments

@dbaron
Copy link
Member

dbaron commented May 10, 2022

The syntax in mediaqueries-4 allows <general-enclosed> productions within mediaqueries.

The general serialization rules for mediaqueries are in cssom-1, but they cover mediaqueries-3.

I don't see anything in either that says how to serialize a mediaquery that contains a part parsed as <general-enclosed>. It looks like the Chromium implementation just serializes "as written" (probably with some tokenization normalization?), but it seems like this should be specified somewhere.

(This does have some interesting side effects; for example ((width)and (height)) is normalized in serialization to add the space before and, but ((width)and (height) or (color)) is not, because it's <general-enclosed>.)

It also seems like perhaps mediaqueries-4 should move the serialization rules out of cssom-1 and make the appropriate edits to them.

cc @andruud

@dbaron dbaron added mediaqueries-4 Current Work cssom-1 Current Work labels May 10, 2022
@andruud
Copy link
Member

andruud commented May 11, 2022

What are the options?

  • Serialize the tokens? (Although I'm not sure if specs define how that should happen in all aspects).
  • Do the custom properties thing? ("Remember the exact original input string").
  • Something else?

@cdoublev
Copy link
Collaborator

cdoublev commented Apr 24, 2023

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 custom property <declaration-value> (related: #6484).

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

aarongable pushed a commit to chromium/chromium that referenced this issue Sep 4, 2024
This is the last of the at-rule prelude parsing, and also extends
into container query parsing and most of sizes attribute parsing
(there's a tiny fraction left).

We change serialization in one WPT test; it's not really defined
how <general-enclosed> should serialize[1], and now we keep trailing
whitespace inside, instead of reducing it to one space.

[1] w3c/csswg-drafts#7266

Change-Id: I0e8ad6bf72ad8524b825a1bee477429c6104103d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5822456
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1350690}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 14, 2024
There is an open issue saying this needs to be specified[1].

Change the expectation to align with Gecko and Chromium for now, which
both keep the original serialization for general-enclosed.

[1] w3c/csswg-drafts#7266

Change-Id: I1986ae7a7f63c2c63ef841f047034eeccdc3828d
aarongable pushed a commit to chromium/chromium that referenced this issue Oct 14, 2024
There is an open issue saying this needs to be specified[1].

Change the expectation to align with Gecko and Chromium for now, which
both keep the original serialization for general-enclosed.

[1] w3c/csswg-drafts#7266

Change-Id: I1986ae7a7f63c2c63ef841f047034eeccdc3828d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5925360
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368182}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 14, 2024
There is an open issue saying this needs to be specified[1].

Change the expectation to align with Gecko and Chromium for now, which
both keep the original serialization for general-enclosed.

[1] w3c/csswg-drafts#7266

Change-Id: I1986ae7a7f63c2c63ef841f047034eeccdc3828d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5925360
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368182}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 14, 2024
There is an open issue saying this needs to be specified[1].

Change the expectation to align with Gecko and Chromium for now, which
both keep the original serialization for general-enclosed.

[1] w3c/csswg-drafts#7266

Change-Id: I1986ae7a7f63c2c63ef841f047034eeccdc3828d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5925360
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368182}
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this issue Oct 16, 2024
…eral-enclosed in test, a=testonly

Automatic update from web-platform-tests
[@container] Change serialization of general-enclosed in test

There is an open issue saying this needs to be specified[1].

Change the expectation to align with Gecko and Chromium for now, which
both keep the original serialization for general-enclosed.

[1] w3c/csswg-drafts#7266

Change-Id: I1986ae7a7f63c2c63ef841f047034eeccdc3828d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5925360
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368182}

--

wpt-commits: 598e86ac6913319529be27d0f1e53d79773c72cc
wpt-pr: 48596
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 16, 2024
…eral-enclosed in test, a=testonly

Automatic update from web-platform-tests
[@container] Change serialization of general-enclosed in test

There is an open issue saying this needs to be specified[1].

Change the expectation to align with Gecko and Chromium for now, which
both keep the original serialization for general-enclosed.

[1] w3c/csswg-drafts#7266

Change-Id: I1986ae7a7f63c2c63ef841f047034eeccdc3828d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5925360
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368182}

--

wpt-commits: 598e86ac6913319529be27d0f1e53d79773c72cc
wpt-pr: 48596
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 22, 2024
…ral-enclosed in test, a=testonly

Automatic update from web-platform-tests
[container] Change serialization of general-enclosed in test

There is an open issue saying this needs to be specified[1].

Change the expectation to align with Gecko and Chromium for now, which
both keep the original serialization for general-enclosed.

[1] w3c/csswg-drafts#7266

Change-Id: I1986ae7a7f63c2c63ef841f047034eeccdc3828d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5925360
Commit-Queue: Rune Lillesveen <futharkchromium.org>
Reviewed-by: Steinar H Gunderson <sessechromium.org>
Cr-Commit-Position: refs/heads/main{#1368182}

--

wpt-commits: 598e86ac6913319529be27d0f1e53d79773c72cc
wpt-pr: 48596

UltraBlame original commit: e2128da95f49fe932ba02f60b6d53eda84e20dd8
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 22, 2024
…ral-enclosed in test, a=testonly

Automatic update from web-platform-tests
[container] Change serialization of general-enclosed in test

There is an open issue saying this needs to be specified[1].

Change the expectation to align with Gecko and Chromium for now, which
both keep the original serialization for general-enclosed.

[1] w3c/csswg-drafts#7266

Change-Id: I1986ae7a7f63c2c63ef841f047034eeccdc3828d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5925360
Commit-Queue: Rune Lillesveen <futharkchromium.org>
Reviewed-by: Steinar H Gunderson <sessechromium.org>
Cr-Commit-Position: refs/heads/main{#1368182}

--

wpt-commits: 598e86ac6913319529be27d0f1e53d79773c72cc
wpt-pr: 48596

UltraBlame original commit: e2128da95f49fe932ba02f60b6d53eda84e20dd8
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 22, 2024
…ral-enclosed in test, a=testonly

Automatic update from web-platform-tests
[container] Change serialization of general-enclosed in test

There is an open issue saying this needs to be specified[1].

Change the expectation to align with Gecko and Chromium for now, which
both keep the original serialization for general-enclosed.

[1] w3c/csswg-drafts#7266

Change-Id: I1986ae7a7f63c2c63ef841f047034eeccdc3828d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5925360
Commit-Queue: Rune Lillesveen <futharkchromium.org>
Reviewed-by: Steinar H Gunderson <sessechromium.org>
Cr-Commit-Position: refs/heads/main{#1368182}

--

wpt-commits: 598e86ac6913319529be27d0f1e53d79773c72cc
wpt-pr: 48596

UltraBlame original commit: e2128da95f49fe932ba02f60b6d53eda84e20dd8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cssom-1 Current Work mediaqueries-4 Current Work
Projects
None yet
Development

No branches or pull requests

3 participants