Fix some pseudo bugs.

This commit is contained in:
Natalie Weizenbaum 2016-08-19 14:01:48 -07:00
parent 0a0f7837b0
commit 64e4954656
2 changed files with 4 additions and 2 deletions

View File

@ -280,6 +280,7 @@ class Parser {
var couldBeSelector = var couldBeSelector =
postColonWhitespace.isEmpty && _lookingAtInterpolatedIdentifier(); postColonWhitespace.isEmpty && _lookingAtInterpolatedIdentifier();
var beforeDeclaration = _scanner.state;
Expression value; Expression value;
try { try {
value = _declarationExpression(); value = _declarationExpression();
@ -298,6 +299,7 @@ class Parser {
// If the value would be followed by a semicolon, it's definitely supposed // If the value would be followed by a semicolon, it's definitely supposed
// to be a property, not a selector. // to be a property, not a selector.
_scanner.state = beforeDeclaration;
var additional = _almostAnyValue(); var additional = _almostAnyValue();
if (_scanner.peekChar() == $semicolon) rethrow; if (_scanner.peekChar() == $semicolon) rethrow;

View File

@ -319,8 +319,8 @@ class _SerializeCssVisitor extends CssVisitor {
throw new UnsupportedError("$parent cannot be converted to CSS."); throw new UnsupportedError("$parent cannot be converted to CSS.");
void visitPseudoSelector(PseudoSelector pseudo) { void visitPseudoSelector(PseudoSelector pseudo) {
_buffer.write($colon); _buffer.writeCharCode($colon);
if (pseudo.type == PseudoType.element) _buffer.write($colon); if (pseudo.type == PseudoType.element) _buffer.writeCharCode($colon);
_buffer.write(pseudo.name); _buffer.write(pseudo.name);
if (pseudo.argument == null && pseudo.selector == null) return; if (pseudo.argument == null && pseudo.selector == null) return;