Bug 247769

Summary: CSSOM fails to serialize some shorthands set to 'initial' (or any css-wide keyword)
Product: WebKit Reporter: Oriol Brufau <obrufau>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=247771
Bug Depends on: 242775, 247988    
Bug Blocks:    

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.