Re: [csswg-drafts] [css-values] Clarifying serialization of negative zero and expression simplification (#9750)

> I thought that negative zero is always tokenized and parsed as positive zero

Tab seemed to agree during the call, but it doesn't seem to be the case from https://drafts.csswg.org/css-syntax-3/#consume-numeric-token

For `-0%`, "consume a number" takes care of the `-0`, returning {type: "integer", sign: "-", value: "0"}. And then the result is a `<percentage-token>` with {sign: "-", value: "0"}.

Browsers don't currently accept percentages in denominators, but they agree with plain numbers:

```js
document.body.style.zIndex = "calc(1 / -0)";
getComputedStyle(document.body).zIndex; // A very negative number, unlike for `calc(1 / 0)`
```

you don't need `calc(1 / (1 / -infinity))` or such in order to get a negative zero.

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


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

Received on Wednesday, 28 February 2024 17:55:32 UTC