]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Handle complex expressions in add() & subtract() (#34047)
authorGaël Poupard <ffoodd@users.noreply.github.com>
Tue, 25 May 2021 05:23:41 +0000 (07:23 +0200)
committerGitHub <noreply@github.com>
Tue, 25 May 2021 05:23:41 +0000 (08:23 +0300)
scss/_functions.scss

index 29114fc8168f2659f5ab2e657dff8792efd8c459..f92355f422327f7ad753ffc94be9d9cf510e9d6c 100644 (file)
@@ -181,6 +181,14 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
     @return $value1 + $value2;
   }
 
+  @if type-of($value1) != number {
+    $value1: unquote("(") + $value1 + unquote(")");
+  }
+
+  @if type-of($value2) != number {
+    $value2: unquote("(") + $value2 + unquote(")");
+  }
+
   @return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + unquote(" + ") + $value2);
 }
 
@@ -201,5 +209,13 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
     @return $value1 - $value2;
   }
 
+  @if type-of($value1) != number {
+    $value1: unquote("(") + $value1 + unquote(")");
+  }
+
+  @if type-of($value2) != number {
+    $value2: unquote("(") + $value2 + unquote(")");
+  }
+
   @return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2);
 }