Re: [csswg-drafts] [css-values] nested `calc()` is not defined by its grammar (#6506)

The [number](https://drafts.csswg.org/css-values-4/#number-value) case is expressed well:

> Number values are denoted by ***‘<number>’***, and represent real numbers, possibly with a fractional component.
>
> When written literally, a ***number*** is either an integer, […]. It corresponds to the <number-token> production in the CSS Syntax Module [CSS-SYNTAX-3].

This shows that it’s talking about values rather than tokens, obviously leaving it open for non-literals.

But, to potentially expand the scope of this issue a bit with a closely-related issue, some others don’t make this clear; [strings](https://drafts.csswg.org/css-values-4/#strings), for example:

> Strings are denoted by ***‘<string>’*** and consist of a sequence of characters delimited by double quotes or single quotes. They correspond to the <string-token> production in the CSS Syntax Module [CSS-SYNTAX-3].

This would seem to declare `<string>` to only be string literals. But I honestly don’t know if it allows non-literals or not, because some places that take `<string>` seem to allow non-literal strings implicitly, and others don’t. For example, [as well as mentioning `<string>`, `content` spells out `<counter>` and `<target>`](https://drafts.csswg.org/css-content/#typedef-content-content-list), which correspond to functions that all produce strings, but doesn’t make any mention of `attr()`, which can also produce a string and which works. But `counters()` says it takes a `<string>` as its second argument, but Firefox at least refuses to accept `counters(name, attr(join, "."))`, which I gather means it’s only accepting a literal string there.

This suggests to me that *something* needs to be changed in spec or implementation on `content` or `counters()`, because they seem to be inconsistent.

It’d be good for these sorts of types to spell it out like number does. e.g.

> Strings are denoted by ***‘&lt;string&gt;’*** and represent a sequence of characters.
>
> When written literally, a ***string*** is a sequence of characters delimited by double quotes or single quotes. It corresponds to the &lt;string-token&gt; production in the CSS Syntax Module [CSS-SYNTAX-3].

Or if it does exclude non-literal strings:

> Literal strings are denoted by ***‘&lt;string&gt;’*** and consist of a sequence of characters delimited by double quotes or single quotes. They correspond to the &lt;string-token&gt; production in the CSS Syntax Module [CSS-SYNTAX-3].

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


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

Received on Wednesday, 25 August 2021 08:25:18 UTC