Support browser hacks in plain CSS mode (#468)

Closes #466
This commit is contained in:
Natalie Weizenbaum 2018-09-05 14:31:59 -07:00 committed by GitHub
parent 9e5ef91f22
commit 048b17495e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,7 @@
## 1.13.2
* Fix support for CSS hacks in plain CSS mode.
## 1.13.1
* Allow an IE-style single equals operator in plain CSS imports.

View File

@ -370,7 +370,24 @@ abstract class StylesheetParser extends Parser {
@protected
Declaration _declaration() {
var start = scanner.state;
var name = interpolatedIdentifier();
Interpolation name;
// Allow the "*prop: val", ":prop: val", "#prop: val", and ".prop: val"
// hacks.
var first = scanner.peekChar();
if (first == $colon ||
first == $asterisk ||
first == $dot ||
(first == $hash && scanner.peekChar(1) != $lbrace)) {
var nameBuffer = new InterpolationBuffer();
nameBuffer.writeCharCode(scanner.readChar());
nameBuffer.write(rawText(whitespace));
nameBuffer.addInterpolation(interpolatedIdentifier());
name = nameBuffer.interpolation(scanner.spanFrom(start));
} else {
name = interpolatedIdentifier();
}
whitespace();
scanner.expectChar($colon);
whitespace();

View File

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