8000 [css-variables] Insert empty comments during serialization to separate adjacent tokens · Issue #7328 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-variables] Insert empty comments during serialization to separate adjacent tokens #7328

@Loirooriol

Description

@Loirooriol
var s = document.body.style;
var cs = getComputedStyle(document.body);
s.cssText = "--a:a; --b:var(--a)b; counter-reset:var(--b)";
cs.counterReset; // "a 0 b 0" or equivalent
cs.getPropertyValue("--b"); // ???

I have noticed that Firefox serializes --b as "a/**/b". this is nice, because then

s.setProperty("--b", cs.getPropertyValue("--b"));
cs.counterReset; // still "a 0 b 0"

However, Blink serializes --b as "ab", so

s.setProperty("--b", cs.getPropertyValue("--b"));
cs.counterReset; // "ab 0" :(

I think https://drafts.csswg.org/css-variables/#serializing-custom-props should standardize what Firefox does in order to have round-trip.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0