[csswg-drafts] [css-cascade-5] [cssom] Serialization of shorthands with reset-only subproperties is under-defined (#12846)

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

== [css-cascade-5] [cssom] Serialization of shorthands with reset-only subproperties is under-defined ==
_Apologies if this is in the spec somewhere and I just couldn't find it (though perhaps that's a sign it could be made clearer)._

According to tested behaviour in WPT, (eg, [here](http://wpt.live/css/css-fonts/font-shorthand-serialization-prevention.html)) this causes `font` to not be serializable:

```css
.target {
 font: "something";
 font-variation-settings: "aaaa" a;
}
```

`font-variation-settings` is a reset-only subproperty of `font`: Using the `font` shorthand always sets it to its initial value. My (wrong) mental model was that reset-only subproperties would not affect the shorthand's value. The [reset-only subproperty definition](https://drafts.csswg.org/css-cascade-5/#reset-only-sub-property) and ["serialize a CSS value" algorithm](https://drafts.csswg.org/cssom-1/#serialize-a-css-value) don't address this.

I think in particular, step 1.1 of "serialize a CSS value" is ambiguous (emphasis mine):

> Let shorthand be the first shorthand property, in preferred order, that **_exactly maps to all of the longhand properties_** in list.

I would not expect a reset-only subproperty to be included in the list of longhand properties, but it seems like it actually should do?

In any case I think this could be clearer. Maybe even just specifying that reset-only subproperties are still considered longhands of the shorthand, so the usual rules apply. As someone coming across these, it's been counter-intuitive, even though I can understand now why it would behave like this.

Tangentially related to #878.

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


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

Received on Tuesday, 23 September 2025 09:19:19 UTC