Skip to content

Define canonical order of longhand properties #6894

@cdoublev

Description

@cdoublev

The specified order of declarations define that shorthand properties [are] expanded into their longhand properties, in canonical order, and a general principle of serialization is that if certain component values can appear in any order without changing the meaning of the value (a pattern typically represented by a double bar || in the value syntax), reorder the component values to use the canonical order of component values as given in the property definition table.

When setting background to a single <final-bg-layer>, Chrome serializes the component values in the order derived from <bg-layer> and append <bg-color> at the end, while Firefox serializes in another order.

style.background = 'url("bg.jpg") left 10% / 100px 100% no-repeat fixed content-box padding-box red'
console.log(style.background)
// Chrome: same as input
// Firefox: red url("bg.jpg") no-repeat fixed left 10% / 100px 100% content-box padding-box

The motivation of this request is two fold. It would be also handy to be able to extract a list of shorthands from eg. w3c/webref (see #2921). Using this tool, I can extract a list of shorthands by searching for individual or shorthand in the initial or computed value fields, but there are some inconsistencies between specifications and I'm not sure that this method is 100% accurate.

Therefore a new definition field value, eg. shorthand for, would answer both parts of this request.

Related: #5741.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions