Re: [csswg-drafts] [css-values-4] `<integer>` grammar terms and `<number>`-returning functions (#11040)

The CSS Working Group just discussed ``[css-values-4] `<integer>` grammar terms and `<number>`-returning functions``, and agreed to the following:

* `RESOLVED: Functions that return a <number> will be rounded to an <integer> when used in <integer> context.`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> TabAtkins: currently our math functions like calc(), sin() etc.<br>
&lt;fantasai> TabAtkins: If they return a non-integer value, but required to return &lt;integer>, we automatically round to nearest integer<br>
&lt;fantasai> TabAtkins: If you a are a function that returns a number, but not a math function, currently invalid to use in &lt;integer><br>
&lt;miriam> +1<br>
&lt;kbabbitt> +0.9<br>
&lt;lea> +calc(infinity)<br>
&lt;fantasai> TabAtkins: Let's just call that valid.<br>
&lt;fantasai> TabAtkins: This will not change literal number usage.<br>
&lt;bkardell> +a<br>
&lt;fantasai> TabAtkins: (that's been invalid for 30 years)<br>
&lt;fantasai> TabAtkins: But this allows number-returning function to be used anywhere.<br>
&lt;fantasai> astearns: If you have a custom property that is defined to be &lt;integer> and you set its value with these, that works<br>
&lt;fantasai> lea: yes, that works<br>
&lt;fantasai> astearns: But if you have a custom property not defined as an integer, and set it using one of these math functions, does that get rounded?<br>
&lt;fantasai> astearns: because not defining var()<br>
&lt;fantasai> TabAtkins: var() will do substitution, and then we resolve the math<br>
&lt;fantasai> astearns: We don't expect compat issues here?<br>
&lt;fantasai> TabAtkins: I think only example of non-math function defined to return a &lt;number> is sibling-index() and sibling-count()<br>
&lt;fantasai> fantasai: That's a spec error!<br>
&lt;oriol> The spec is right, they return an &lt;integer> already<br>
&lt;fantasai> TabAtkins: But we could have them in theory. We made some up, but dropped them.<br>
&lt;fantasai> TabAtkins: So we can fix this problem for anything we do in the future.<br>
&lt;fantasai> PROPOSED: Functions that return a &lt;number> will be rounded to an &lt;integer> when used in &lt;integer> context.<br>
&lt;fantasai> oriol: Seems reasonable<br>
&lt;fantasai> RESOLVED: Functions that return a &lt;number> will be rounded to an &lt;integer> when used in &lt;integer> context.<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11040#issuecomment-2770596975 using your GitHub account


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

Received on Tuesday, 1 April 2025 20:22:53 UTC