| Summary: | myElement.style.cssText exposes the order of the CSSPropertyID enum values to the web | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Myles C. Maxfield <mmaxfield> | ||||
| Component: | CSS | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | karlcow, obrufau, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Bug Depends on: | 190753 | ||||||
| Bug Blocks: | |||||||
| Attachments: |
|
||||||
in both Firefox and Chrome, latest versions as of this date, it returns simply: `all:unset` in Safari it really returns everything set as unset. I have the feeling that this is more or less very similar to Bug 190496 This is a parsing problem, not a serialization one:
var myElement = document.createElement("div");
myElement.style.cssText = "all: unset";
console.log([...myElement.style]);
In Firefox the order also seems to expose internal details.
Blink doesn't treat 'all' as a shorthand.
I'm not sure if the order is actually defined anywhere, I had the impression it should be kinda alphabetical but I can't find that, and https://drafts.csswg.org/css-logical/#box says > shorthand properties that encompass both logical and physical longhands (such as the all shorthand) set their physical longhands last. Created attachment 462667 [details] developer tools in Safari, Firefox and Chrome (note to myself) all is defined in https://drafts.csswg.org/css-cascade-5/#propdef-all > The all property is a shorthand that resets all CSS properties except direction and unicode-bidi. It only accepts the CSS-wide keywords. It does not reset custom properties [css-variables-1]. and https://drafts.csswg.org/css-cascade-5/#shorthand-property > Some properties are shorthand properties, meaning that they allow authors to specify the values of several properties with a single property. A shorthand property sets all of its longhand sub-properties, exactly as if expanded in place. and >This means that a shorthand property declaration always sets all of its sub-properties, even those that are not explicitly set. Carelessly used, this might result in inadvertently resetting some sub-properties. Carefully used, a shorthand can guarantee a “blank slate” by resetting sub-properties inadvertently cascaded from other sources. cssText not serializing the 'all' shorthand is bug 190753. But as already mentioned, the order will still be exposed regardless of that. |
let myElement = document.createElement("div"); myElement.style.cssText = "all: unset"; console.log(myElement.style.cssText); The order of the properties in the result matches the order of the enum values in enum CSSPropertyID in CSSPropertyNames.h