- From: Guillaume via GitHub <sysbot+gh@w3.org>
- Date: Wed, 25 Sep 2024 09:54:55 +0000
- To: public-css-archive@w3.org
cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-values-4] Serialization of Negate and Invert nodes seems incorrect == Per [spec](https://drafts.csswg.org/css-values-4/#serialize-a-calculation-tree), `1 - sibling-index()` should serialize with `1 - (-1 * sibling-index())`. > 4. If `root` is a Negate node, let `s` be a string initially containing "(-1 * ". > > [...] > 5. [...] > 6. If `root` is a Sum node, let `s` be a string initially containing "(". > > [...] > > For each `child` of `root` beyond the first: > > 1. If `child` is a Negate node, append " - " to `s`, then serialize the Negate’s child and append the result to `s`. It should presumably serialize as is. An equivalent problem exists for `2 / sibling-index()`. I think steps 4 and 5 (Negate and Invert) can be removed: steps 6 and 7 could simply serialize the child of Negate and Invert, and wrap each serialization of their child in `()` when it is Sum or Product node (to handle cases like `1 - (1 * sibling-index())`. Alternatively, they could wrap their own serialization only when the parent node is a Sum or Product node, which requires to pass the parent node recursively, and to remove the following from [serialize a math function](https://drafts.csswg.org/css-values-4/#serialize-a-math-function), which seems a little awkward: > [...] If a result of this serialization starts with a "(" (open parenthesis) and ends with a ")" (close parenthesis), remove those characters from the result. [...] Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10943 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 25 September 2024 09:54:56 UTC