mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-22 22:02:00 +01:00
Deprecate passing non-deg
units to hwb()
's $hue
argument (#1747)
This was overlooked in #1175, because the spec said that `hwb()` should already be throwing an error if non-`deg` units were passed. However, Dart Sass didn't implement the spec correctly and these units were in fact not being checked at all. See #1174
This commit is contained in:
parent
4b53c163d7
commit
1bd774485d
@ -8,6 +8,8 @@
|
||||
|
||||
See https://sass-lang.com/d/bogus-combinators for more details.
|
||||
|
||||
* Deprecate passing non-`deg` units to `color.hwb()`'s `$hue` argument.
|
||||
|
||||
### JS API
|
||||
|
||||
* Add a `charset` option that controls whether or not Sass emits a
|
||||
|
@ -121,7 +121,7 @@ final global = UnmodifiableListView([
|
||||
_function("adjust-hue", r"$color, $degrees", (arguments) {
|
||||
var color = arguments[0].assertColor("color");
|
||||
var degrees = arguments[1].assertNumber("degrees");
|
||||
_checkAngle(degrees);
|
||||
_checkAngle(degrees, "degrees");
|
||||
return color.changeHsl(hue: color.hue + degrees.value);
|
||||
}),
|
||||
|
||||
@ -635,7 +635,7 @@ Value _hsl(String name, List<Value> arguments) {
|
||||
}
|
||||
|
||||
/// Prints a deprecation warning if [hue] has a unit other than `deg`.
|
||||
void _checkAngle(SassNumber angle, [String? name]) {
|
||||
void _checkAngle(SassNumber angle, String name) {
|
||||
if (!angle.hasUnits || angle.hasUnit('deg')) return;
|
||||
|
||||
var message = StringBuffer()
|
||||
@ -692,6 +692,7 @@ Value _hwb(List<Value> arguments) {
|
||||
var whiteness = arguments[1].assertNumber("whiteness");
|
||||
var blackness = arguments[2].assertNumber("blackness");
|
||||
|
||||
_checkAngle(hue, "hue");
|
||||
whiteness.assertUnit("%", "whiteness");
|
||||
blackness.assertUnit("%", "blackness");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user