Fix @import with supports().

This commit is contained in:
Natalie Weizenbaum 2017-01-14 14:56:33 -08:00
parent 9031a7f554
commit eab36eafe5
3 changed files with 8 additions and 5 deletions

View File

@ -6,6 +6,8 @@
* Properly handle variable scoping in `@at-root` and nested properties.
* Fix `@import` with a `supports()` clause.
## 1.0.0-alpha.8
* Add the `content-exists()` function.

View File

@ -690,9 +690,8 @@ abstract class StylesheetParser extends Parser {
whitespace();
var queries = _tryImportQueries();
if (_isPlainImportUrl(url)) {
var interpolation =
new Interpolation([scanner.substring(start.position)], urlSpan);
return new StaticImport(interpolation, scanner.spanFrom(start),
return new StaticImport(
new Interpolation([urlSpan.text], urlSpan), scanner.spanFrom(start),
supports: queries?.item1, media: queries?.item2);
} else if (_inControlDirective || _inMixin) {
_disallowedAtRule(ruleStart);
@ -729,6 +728,8 @@ abstract class StylesheetParser extends Parser {
whitespace();
supports = new SupportsNegation(
_supportsConditionInParens(), scanner.spanFrom(start));
} else if (scanner.peekChar() == $lparen) {
supports = _supportsCondition();
} else {
var name = _expression();
scanner.expectChar($colon);

View File

@ -618,7 +618,7 @@ class _PerformVisitor
var url = _interpolationToValue(import.url);
var supports = import.supports;
var resolvedSupports = supports is SupportsDeclaration
? "${supports.name.accept(this).toCssString()}: "
? "(${supports.name.accept(this).toCssString()}: "
"${supports.value.accept(this).toCssString()})"
: (supports == null ? null : _visitSupportsCondition(supports));
var mediaQuery =
@ -627,7 +627,7 @@ class _PerformVisitor
var node = new CssImport(url, import.span,
supports: resolvedSupports == null
? null
: new CssValue(resolvedSupports, import.supports.span),
: new CssValue("supports($resolvedSupports)", import.supports.span),
media: mediaQuery);
if (_parent != _root) {