[csswg-drafts] [css-shapes-1] Optional values shouldn't be serialized (#8695)

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

== [css-shapes-1] Optional values shouldn't be serialized ==


Currently the CSS Shapes draft [specifies](https://www.w3.org/TR/css-shapes-1/#basic-shape-serialization):

> To serialize the [<basic-shape>](https://www.w3.org/TR/css-shapes-1/#typedef-basic-shape) functions, serialize as per their individual grammars, in the order the grammars are written in, avoiding calc() expressions where possible, avoiding calc() transformations, omitting components when possible without changing the meaning, joining space-separated tokens with a single space, and following each serialized comma with a single space.

This seems mostly fine, except there's a couple problems:

1. There's an _example_ that says:

   > Omitting components means that some default values do not show up in the serialization. But since [<position>](https://drafts.csswg.org/css-values-4/#typedef-position) always uses the 2- or 4-value form, a default <position> is not omitted.

   which is nonsense, because omitting a default `at <position>` is required by the normative text above.

   This example is then tested in WPT, which shows that we (unfortunately) have interop on the example rather than on the normative text. However, having special rules that go against our general serialization principles without good reason is an anti-pattern. We should be consistent and allow `at <position>` to be omitted from the serialization just like any other optional component.

2. The guidance about “avoiding calc() expressions where possible, avoiding calc() transformations” conflicts with our more generally-applicable rules about serializing `<position>` and `calc()` values, which distinguish specified-value and computed-value serializations in very particular ways.

Proposal:
1. Fix the examples and tests, and file implementation bugs, allowing `at <position>` to be omitted, consistent with our general serialization principles.
2. Remove guidance about `calc()` serialization, allowing the spec to defer to the more specific serialization rules in css-values-4.

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


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

Received on Thursday, 6 April 2023 21:13:08 UTC