Re: [csswg-drafts] [css-values-5] What is the MVP for inline conditionals on custom properties? (#10064)

@tabatkins re: "empty token stream", I think that might be a typo.  I read [CSS Syntax](https://www.w3.org/TR/css-syntax-3/#tokenizing-and-parsing) and as one would expect, tokens are described with respect to parsing:


> 3. Tokenizing and Parsing CSS
User agents must use the parsing rules described in this specification to generate the [[CSSOM]](https://www.w3.org/TR/css-syntax-3/#biblio-cssom) trees from text/css resources. Together, these rules define what is referred to as the CSS parser.


Once the CSS is parsed and the CSSOM generated where does this concept of tokens come up again?  What do tokens have to do with compute time values?

I also read [CSS Variables](https://www.w3.org/TR/css-variables/#pending-substitution-value) as you indicated this was the relevent spec.  There is no reference to "empty token stream" in either of these documents but CSS Variables does talk about "empty strings" and "empty values" (the latter is what I suspect is meant in the new `if()` spec so as not to confuse with IACVT which serializes to the empty string):

> 2.2. Guaranteed-Invalid Values
The initial value of a [custom property](https://www.w3.org/TR/css-variables/#custom-property) is a guaranteed-invalid value. As defined in [§ 3 Using Cascading Variables: the var() notation](https://www.w3.org/TR/css-variables/#using-variables), using [var()](https://www.w3.org/TR/css-variables/#funcdef-var) to substitute a custom property with this as its value makes the property referencing it [invalid at computed-value time](https://www.w3.org/TR/css-variables/#invalid-at-computed-value-time).

> This value serializes as the empty string, but actually writing an **empty value** into a custom property, like --foo: ;, is a valid (empty) value, not the [guaranteed-invalid value](https://www.w3.org/TR/css-variables/#guaranteed-invalid-value).
 
Again, the new [CSS Values](https://www.w3.org/TR/css-values-5/) section references "empty token stream" which AFAICT is not defined anywhere else in the spec and doesn't make sense if tokens are only a concern during the parsing step and not at custom property compute time.  As you can see the question here is what happens when no condition in `if()`'s argument list is true, and this cannot be known at parse time, only compute time:

> 7.3. Conditional Value Selection: the [if()](https://www.w3.org/TR/css-values-5/#funcdef-if) notation
The if() notation is an [arbitrary substitution function](https://www.w3.org/TR/css-values-5/#arbitrary-substitution-function) that represents conditional values. Its argument consists of an ordered semi-colon–separated list of statements, each consisting of a condition followed by a colon followed by a value. An [if()](https://www.w3.org/TR/css-values-5/#funcdef-if) notation represents the value corresponding to the first condition in its argument list to be true; if no condition matches, then the if() notation represents an empty token stream.


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


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

Received on Tuesday, 25 February 2025 09:19:16 UTC