Bug 247769 - CSSOM fails to serialize some shorthands set to 'initial' (or any css-wide keyword)
Summary: CSSOM fails to serialize some shorthands set to 'initial' (or any css-wide ke...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on: 242775 247988
Blocks:
  Show dependency treegraph
 
Reported: 2022-11-10 15:41 PST by Oriol Brufau
Modified: 2022-12-21 07:30 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oriol Brufau 2022-11-10 15:41:47 PST
Run this code:

var allCSSProps = new Set();
for (let obj = document.createElement("div").style; obj; obj = Reflect.getPrototypeOf(obj)) {
  for (let name of Object.getOwnPropertyNames(obj)) {
    let prop = name.replace(/[A-Z]/g, c => "-" + c.toLowerCase());
    if (CSS.supports(prop, "initial")) {
      allCSSProps.add(prop);
    }
  }
}
var style = document.createElement("div").style;
var bad = new Map();
for (let prop of allCSSProps) {
  style.cssText = "";
  style.setProperty(prop, "initial");
  let result = style.getPropertyValue(prop);
  if (result !== "initial") {
    bad.set(prop, result);
  }
}
bad;

Expected: empty map
Actual: a map with some failures:

Map {
  "-webkit-border-radius" => "",
  "-webkit-column-break-after" => "",
  "-webkit-column-break-before" => "",
  "-webkit-column-break-inside" => "",
  "-webkit-perspective" => "",
  "grid" => "",
  "grid-area" => "initial / initial / initial / initial"
  "grid-column" => "initial / initial"
  "grid-row" => "initial / initial"
  "offset" => "",
}
Comment 1 Radar WebKit Bug Importer 2022-11-17 15:42:17 PST
<rdar://problem/102489409>
Comment 2 Oriol Brufau 2022-12-21 07:30:08 PST
Improved in bug 247988, then fixed by bug 242775.