Add support for new special number strings (#556)

See sass/sass#2584
This commit is contained in:
Natalie Weizenbaum 2019-01-09 15:50:04 -05:00 committed by GitHub
parent 12f53f5e1c
commit 55ebe56d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,8 @@
## 1.16.0
* `rgb()` and `hsl()` now treat unquoted strings beginning with `env()`,
`min()`, and `max()` as special number strings like `calc()`.
## 1.15.3
* Properly merge `all and` media queries. These queries were previously being

View File

@ -31,7 +31,7 @@ class SassString extends Value implements ext.SassString {
bool get isSpecialNumber {
if (hasQuotes) return false;
if (text.length < "calc(_)".length) return false;
if (text.length < "min(_)".length) return false;
var first = text.codeUnitAt(0);
if (equalsLetterIgnoreCase($c, first)) {
@ -43,6 +43,21 @@ class SassString extends Value implements ext.SassString {
if (!equalsLetterIgnoreCase($a, text.codeUnitAt(1))) return false;
if (!equalsLetterIgnoreCase($r, text.codeUnitAt(2))) return false;
return text.codeUnitAt(3) == $lparen;
} else if (equalsLetterIgnoreCase($e, first)) {
if (!equalsLetterIgnoreCase($n, text.codeUnitAt(1))) return false;
if (!equalsLetterIgnoreCase($v, text.codeUnitAt(2))) return false;
return text.codeUnitAt(3) == $lparen;
} else if (equalsLetterIgnoreCase($m, first)) {
var second = text.codeUnitAt(1);
if (equalsLetterIgnoreCase($a, second)) {
if (!equalsLetterIgnoreCase($x, text.codeUnitAt(2))) return false;
return text.codeUnitAt(3) == $lparen;
} else if (equalsLetterIgnoreCase($i, second)) {
if (!equalsLetterIgnoreCase($n, text.codeUnitAt(2))) return false;
return text.codeUnitAt(3) == $lparen;
} else {
return false;
}
} else {
return false;
}

View File

@ -1,5 +1,5 @@
name: sass
version: 1.15.3
version: 1.16.0-dev
description: A Sass implementation in Dart.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/sass/dart-sass