- From: Guillaume via GitHub <sysbot+gh@w3.org>
- Date: Thu, 16 Dec 2021 09:13:06 +0000
- To: public-css-archive@w3.org
cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts: == Define canonical order of longhand properties == The [specified order of declarations](https://drafts.csswg.org/cssom/#ref-for-concept-declarations-specified-order) define that *shorthand properties [are] expanded into their longhand properties, in canonical order*, and a [general principle of serialization](https://drafts.csswg.org/cssom/#serialize-a-css-value) 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 `<bg-color>` first then in the order defined in prose: *for each layer the shorthand first sets the corresponding layer of each of background-image, background-position, background-size, background-repeat, background-origin, background-clip and background-attachment [...]. Finally background-color is set to the specified color, if any, else set to its initial value.* ```js 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`](https://github.com/w3c/webref/). 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. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6894 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 16 December 2021 09:13:08 UTC