When the cssText getter calls this.getPropertyValue(name) and the value is the Number 0, return this[name] || ""; returns the second part of the condition.
I quickly checked the spec and saw that setProperty takes value of type DOMString, and that a DOMString, by MDN’s description, is effectively just a JS string. This is already how the CSSOM.parse part of the API works, of course, so I propose having setProperty coerce it’s value argument to a string, i.e. change CSSStyleDeclaration.js:54 to:
Here’s an illustration of the problem (see it demonstrated in this Tonic notebook):
When the
cssText
getter callsthis.getPropertyValue(name)
and the value is the Number 0,return this[name] || "";
returns the second part of the condition.I quickly checked the spec and saw that
setProperty
takesvalue
of typeDOMString
, and that a DOMString, by MDN’s description, is effectively just a JS string. This is already how theCSSOM.parse
part of the API works, of course, so I propose havingsetProperty
coerce it’s value argument to a string, i.e. change CSSStyleDeclaration.js:54 to: