[csswg-drafts] [css-syntax] Tokenizer and whitespace concatenation (#10640)

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

== [css-syntax] Tokenizer and whitespace concatenation ==
The css-syntax spec seems to:

- tokenize multiple adjacent whitespace characters into a single whitespace token
- consider a newline as a whitespace character

It's confirmed by the serialization section : https://drafts.csswg.org/css-syntax-3/#serialization
> The only requirement for serialization is that it must "round-trip" with parsing, that is, parsing the stylesheet must produce the same data structures as parsing, serializing, and parsing again, except for consecutive [<whitespace-token>](https://drafts.csswg.org/css-syntax-3/#typedef-whitespace-token)s, which may be collapsed into a single token.


No browser implements this though:
- Chome/Firefox/WebKit all remember the number of whitespaces for serialization
- Chrome/Firefox distinguish newline character from whitespace

Some Interop 2024 depends on this behavior because they use the serialization of a custom property value : https://github.com/web-platform-tests/wpt/blob/ad7e196b12/css/css-syntax/custom-property-rule-ambiguity.html#L50

WDYT ?

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


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

Received on Monday, 29 July 2024 19:22:36 UTC