Skip to content

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

@AtkinsSJ

Description

@AtkinsSJ

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) this causes font to not be serializable:

.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 and "serialize a CSS value" algorithm 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions