[Webkit-unassigned] [Bug 225206] New: CSS shorthand should serialize as empty string when longhands have variables
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Apr 29 13:26:23 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=225206
Bug ID: 225206
Summary: CSS shorthand should serialize as empty string when
longhands have variables
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: CSS
Assignee: webkit-unassigned at lists.webkit.org
Reporter: obrufau at igalia.com
Run this code:
```js
document.body.style.cssText = `
--t: 1px 2px;
--r: 3px;
--b: 4px;
--l: ;
margin-top: var(--t);
margin-right: var(--r);
margin-bottom: var(--b);
margin-left: var(--l);
`;
getComputedStyle(document.body).margin; // "0px 3px 4px 0px"
document.body.style.margin; // BAD: "var(--t) var(--r) var(--b) var(--l)"
document.body.style.margin += "";
getComputedStyle(document.body).margin; // "1px 2px 3px 4px"
```
The margin shorthand shouldn't be serialized concatenating the var() notations, because that can have a different meaning!
It should be serialized as empty string instead.
The specs are not much clear about this (https://github.com/w3c/csswg-drafts/issues/6253), but Chromium and Firefox do the reasonable thing and serialize as empty string.
--
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/20210429/88dbafdc/attachment.htm>
More information about the webkit-unassigned
mailing list