-
Notifications
You must be signed in to change notification settings - Fork 758
Open
Labels
css-variables-1Current WorkCurrent Work
Description
Consider this code:
var s = document.body.style;
s.setProperty("--a", "a(");
s.setProperty("--b", "b");The spec says "Specified values of custom properties must be serialized exactly as specified by the author". That's what Blink does, but it's bad!
s.getPropertyValue("--a"); // "a("
s.getPropertyValue("--b"); // "b"
s.cssText; // "--a:a(; --b:b;"
s.cssText = s.cssText;
s.getPropertyValue("--a"); // "a(; --b:b;"
s.getPropertyValue("--b"); // ""
s.cssText; // "--a:a(; --b:b;;"
s.cssText = s.cssText;
s.getPropertyValue("--a"); // "a(; --b:b;;"
s.getPropertyValue("--b"); // ""
s.cssText; // "--a:a(; --b:b;;;"
s.cssText = s.cssText;
s.getPropertyValue("--a"); // "a(; --b:b;;;"
s.getPropertyValue("--b"); // ""
s.cssText; // "--a:a(; --b:b;;;;"I think Firefox is better, since it round-trips:
s.getPropertyValue("--a"); // "a()"
s.getPropertyValue("--b"); // "b"
s.cssText; // "--a: a(); --b: b;"
s.cssText = s.cssText;
s.getPropertyValue("--a"); // "a()"
s.getPropertyValue("--b"); // "b"
s.cssText; // "--a: a(); --b: b;" Metadata
Metadata
Assignees
Labels
css-variables-1Current WorkCurrent Work