Skip to content
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

[css-syntax-3] Tokenize comments into whitespaces #11252

Open
cdoublev opened this issue Nov 20, 2024 · 0 comments
Open

[css-syntax-3] Tokenize comments into whitespaces #11252

cdoublev opened this issue Nov 20, 2024 · 0 comments

Comments

@cdoublev
Copy link
Collaborator

The current version of Firefox accepts calc(1/**/+ 1) or calc(1 +/**/1) whereas the current version of Chrome does not. Per spec, Chrome is correct.

There is no test for this on WPT. Based on discussions in the www-style public archives, there was an intention to relax the whitespace requirement in the future.

Both browsers accept :nth-child(+/**/n) as a selector but not U/**/+0-1 as a unicode-range. The related specs do not accept a whitespace at the place of the comment.

Has it ever been considered to tokenize comments into whitespaces?

This would make these cases more consistent. The non-normative requirement for the serialization of "any consecutive pair of tokens" (not separated by whitespaces) in CSS Syntax 3 § 9. Serialization might then no longer be necessary.

I suspect the breaking change for <an+b> is ok. The unicode range tests on WPT still expect comments to be valid within the range, but I presume it will be updated at some point (related: #8835).

Also, has it ever been considered to consume a run of whitespaces/comments into a single <whitespace-token>?

There is currently no guarantee that a token stream does not include consecutive whitespaces. For example, the result from tokenizing 1 /**/ 1 includes two consecutive whitespaces.

This would not fix any problem but since consecutive whitespaces are collapsed, this seems consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant