[Webkit-unassigned] [Bug 271001] New: CSSOM serialization unexpectedly expands some shorthand properties
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Mar 14 13:23:08 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=271001
Bug ID: 271001
Summary: CSSOM serialization unexpectedly expands some
shorthand properties
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebCore JavaScript
Assignee: webkit-unassigned at lists.webkit.org
Reporter: qianlangchen at apple.com
(See also https://webkit.org/b/75538 and https://webkit.org/b/73002, where this bug has been reported and a fix was attempted.)
The return values of `CSSRule.cssText` and `CSSStyleDeclaration.cssText` getters expand some shorthand CSS properties, specifically font-related shorthands like `font` or `font-variant`.
To reproduce, run this code in Safari inspector's console:
s = new CSSStyleSheet();
s.replaceSync('body { font: 12px serif; }');
console.log(s.cssRules[0].cssText);
Observe that the output contains all the expanded longhand properties:
body { font-style: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: serif; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; }
The expected output should just be
body { font: 12px serif; }
The issue should be associated with how WebKit serializes a CSS declaration. The specs (https://drafts.csswg.org/cssom-1/#serialize-a-css-declaration-block), albeit very hard to read, suggest that shorthand properties should not be expanded and replaced with their longhand equivalents.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240314/12b296b1/attachment-0001.htm>
More information about the webkit-unassigned
mailing list