Skip to content

Commit f2d9800

Browse files
committed
Fix "-0" for toString()
1 parent cd6a22a commit f2d9800

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

parse-css.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ class NumberToken extends CSSParserToken {
704704
toString() {
705705
const name = this.isInteger ? "INT" : "NUMBER";
706706
const sign = this.sign == "+" ? "+" : "";
707-
return `${name}(${sign}${this.value})`;
707+
return `${name}(${formatNumber(this.value, this.sign)})`;
708708
}
709709
toJSON() { return {type:this.type, value:this.value, isInteger:this.isInteger, sign:this.sign}; }
710710
toSource() { return formatNumber(this.value, this.sign); }
@@ -717,8 +717,7 @@ class PercentageToken extends CSSParserToken {
717717
this.sign = sign;
718718
}
719719
toString() {
720-
const sign = this.sign == "+" ? "+" : "";
721-
return `PERCENTAGE(${sign}${this.value})`;
720+
return `PERCENTAGE(${formatNumber(this.value, this.sign)})`;
722721
}
723722
toJSON() { return {type:this.type, value:this.value, sign:this.sign}; }
724723
toSource() { return `${formatNumber(this.value, this.sign)}%`; }
@@ -733,8 +732,7 @@ class DimensionToken extends CSSParserToken {
733732
this.sign = sign;
734733
}
735734
toString() {
736-
const sign = this.sign == "+" ? "+" : "";
737-
return `DIM(${sign}${this.value}, ${this.unit})`;
735+
return `DIM(${formatNumber(this.value, this.sign)}, ${this.unit})`;
738736
}
739737
toJSON() { return {type:this.type, value:this.value, isInteger:this.isInteger, unit:this.unit, sign:this.sign}; }
740738
toSource() {

0 commit comments

Comments
 (0)