Skip to content

Commit 2c5f1e9

Browse files
authored
Use correct notation for multiple denominator units (#2375)
See: https://physics.nist.gov/cuu/Units/checklist.html * use parentheses
1 parent d58e219 commit 2c5f1e9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
* Fix a slight inaccuracy case when converting to `srgb-linear` and
1414
`display-p3`.
1515

16+
* **Potentially breaking bug fix:** `math.unit()` now wraps multiple denominator
17+
units in parentheses. For example, `px/(em*em)` instead of `px/em*em`.
18+
1619
### JS API
1720

1821
* Fix `SassColor.interpolate()` to allow an undefined `options` parameter, as

lib/src/value/number.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,8 @@ abstract class SassNumber extends Value {
852852
([], [var denominator]) => "$denominator^-1",
853853
([], _) => "(${denominators.join('*')})^-1",
854854
(_, []) => numerators.join("*"),
855-
_ => "${numerators.join("*")}/${denominators.join("*")}"
855+
(_, [var denominator]) => "${numerators.join("*")}/$denominator",
856+
_ => "${numerators.join("*")}/(${denominators.join("*")})",
856857
};
857858

858859
bool operator ==(Object other) {

0 commit comments

Comments
 (0)