[csswg-drafts] [css-typed-om][css-values] Clarification on percieved ambiguity between WPT and calc() specification (#10752)

weinig has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-typed-om][css-values] Clarification on percieved ambiguity between WPT and calc() specification ==
I spent the last few days working on a new implementation of calc() and have run into some regressions in WPT tests where I am not sure if the tests are in error, or my implementation (and interpretation of the spec) is.

<hr> 

The first type of failure seen is due to no removing `0px` from computed values. For example, for the test [css/css-flexbox/parsing/flex-basis-computed.html](https://github.com/web-platform-tests/wpt/blob/053a9a2f43/`css/css-flexbox/parsing/flex-basis-computed.html`):


```
- PASS Property flex-basis value 'calc(10% + 0px)'
+ FAIL Property flex-basis value 'calc(10% + 0px)' assert_equals: expected "10%" but got "calc(10% + 0px)"
```

Back in 2019, there was a discussion on this https://github.com/w3c/csswg-drafts/issues/3482#issuecomment-451590359, where it is stated the 0px in these cases should go away, but I wanted to make sure that still held, and if so, double down on clarifying this in the spec, as it wasn't clear to me why this would be the case, as the [note](https://drafts.csswg.org/css-values-4/#simplify-a-calculation-tree) in the simplification section states:

> NOTE: Zero-valued terms cannot be simply removed from a Sum; they can only be combined with other values that have identical units. (This is because the mere presence of a unit, even with a zero value, can sometimes imply a change in behavior.)

<hr>

The second kind of failure is due to use of (px / px).

In addition to the one I noted in https://github.com/w3c/csswg-drafts/issues/10733, another example is the test [css/css-properties-values-api/register-property-syntax-parsing.html](https://github.com/web-platform-tests/wpt/blob/053a9a2f43/css/css-properties-values-api/register-property-syntax-parsing.html)

```
- PASS syntax:'<length>', initialValue:'calc(5px * 3px / 6px)' is invalid
+ FAIL syntax:'<length>', initialValue:'calc(5px * 3px / 6px)' is invalid assert_throws_dom: function "() => CSS.registerProperty({name: name, syntax: syntax, initialValue: initialValue, inherits: false})" did not throw
```

Is there any reason use of unit algebra in this circumstance would be illegal?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10752 using your GitHub account


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

Received on Sunday, 18 August 2024 00:14:25 UTC