mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-21 21:31:11 +01:00
Merge pull request #219 from sass/fix-conversion-error
Fix some unit math issues
This commit is contained in:
commit
2f1e40eb35
@ -13,6 +13,12 @@
|
||||
* Fix some cases where equivalent numbers wouldn't count as the same keys in
|
||||
maps.
|
||||
|
||||
* Fix a bug where multiplication like `(1/1px) * (1px/1)` wouldn't properly
|
||||
cancel out units.
|
||||
|
||||
* Fix a bug where dividing by a compatible unit would produce an invalid
|
||||
result.
|
||||
|
||||
### Dart API
|
||||
|
||||
* Add a `functions` parameter to `compile()`, `compleString()`,
|
||||
|
@ -407,11 +407,11 @@ class SassNumber extends Value implements ext.SassNumber {
|
||||
List<String> denominators2) {
|
||||
// Short-circuit without allocating any new unit lists if possible.
|
||||
if (numerators1.isEmpty) {
|
||||
if (denominators2.isEmpty) {
|
||||
if (denominators2.isEmpty &&
|
||||
!_areAnyConvertible(denominators1, numerators2)) {
|
||||
return new SassNumber.withUnits(value,
|
||||
numeratorUnits: numerators2, denominatorUnits: denominators1);
|
||||
} else if (denominators1.isEmpty &&
|
||||
!_areAnyConvertible(numerators1, denominators2)) {
|
||||
} else if (denominators1.isEmpty) {
|
||||
return new SassNumber.withUnits(value,
|
||||
numeratorUnits: numerators2, denominatorUnits: denominators2);
|
||||
}
|
||||
@ -444,7 +444,7 @@ class SassNumber extends Value implements ext.SassNumber {
|
||||
removeFirstWhere<String>(mutableDenominators1, (denominator) {
|
||||
var factor = _conversionFactor(numerator, denominator);
|
||||
if (factor == null) return false;
|
||||
value *= factor;
|
||||
value /= factor;
|
||||
return true;
|
||||
}, orElse: () {
|
||||
newNumerators.add(numerator);
|
||||
|
Loading…
x
Reference in New Issue
Block a user