-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define canonical order of longhand properties #6894
Comments
The order in It seems Chromium's implementation is incorrect as it should follow the canonical order as described in https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue. Interestingly, the serialization puts the color value first when working with the computed style. document.body.style.background = 'url("bg.jpg") left 10% / 100px 100% no-repeat fixed content-box padding-box red'
console.log(getComputedStyle(document.body).background)
// rgb(255, 0, 0) url("bg.jpg") no-repeat fixed 0% 10% / 100px 100% content-box padding-box That aside, the request to add a Sebastian |
Thanks for the links. It's interesting to have these historical details. So Firefox uses the order defined in the title of the definition of
I might not have opened this issue otherwise, sorry. But this field could also be defined explicitly to make its interpretation less ambiguous in some cases. For example, for |
Another case where the canonical order is not obvious from reading its grammar:
Should |
This creates side effects on WPT where for example the 5th test fails because of the order of values after serialization more than the fact of having multiple values for the background. |
I think the order is clear in the spec. Chromium / WebKit seem wrong here. |
I guess we can keep this open if you want a more structured way to access the order, though? Feel free to reopen if so, though that's probably an editorial issue. |
I cannot understand how it can be clear from reading the value definition. Firefox is consistent and puts Firefox also puts The property definition tables already have a
It would be clearer with The TLDR: But feel free to keep it closed: I ended up with searching for |
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.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 forindividual
orshorthand
in theinitial
orcomputed 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.
The text was updated successfully, but these errors were encountered: