Re: [csswg-drafts] [css-values-4] What happens to sign(%) when % has no meaning? (#12204)

https://drafts.csswg.org/css-values/#calc-type-checking

> If, in the context in which the [math function](https://drafts.csswg.org/css-values/#math-function) containing this [calculation](https://drafts.csswg.org/css-values/#calc-calculation) is placed, [<percentage>](https://drafts.csswg.org/css-values/#percentage-value)s are resolved relative to another type of value (such as in [width](https://drafts.csswg.org/css-sizing-3/#propdef-width), where <percentage> is resolved against a [<length>](https://drafts.csswg.org/css-values/#length-value)), and that other type is not [<number>](https://drafts.csswg.org/css-values/#number-value), the [type](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-type) is determined as the other type, but with a [percent hint](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-percent-hint) set to that other type.
> 
>     Otherwise, the [type](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-type) is «[ "percent" → 1 ]», with a [percent hint](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-percent-hint) of "percent".

It seems to me that the "otherwise" covers the case of percentages not resolving against anything because they aren't valid.

So `z-index: sign(10% - 1)` is invalid (like `z-index: calc(10% - 1)`) because you are trying to add a value with type «[ "percent" → 1 ]» and a value with type «[ ]».

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


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

Received on Friday, 16 May 2025 21:48:47 UTC