Fix unquoted string serialization again.

This commit is contained in:
Natalie Weizenbaum 2016-10-18 17:36:13 -07:00
parent 0a6ebc6f8c
commit 99e0a1100f

View File

@ -604,15 +604,22 @@ class _SerializeCssVisitor
/// Writes an unquoted string with [string] contents to [_buffer]. /// Writes an unquoted string with [string] contents to [_buffer].
void _visitUnquotedString(String string) { void _visitUnquotedString(String string) {
var afterNewline = false;
for (var i = 0; i < string.length; i++) { for (var i = 0; i < string.length; i++) {
var char = string.codeUnitAt(i); var char = string.codeUnitAt(i);
switch (char) { switch (char) {
case $lf: case $lf:
_buffer.writeCharCode($space); _buffer.writeCharCode($space);
afterNewline = true;
break;
case $space:
if (!afterNewline) _buffer.writeCharCode($space);
break; break;
default: default:
_buffer.writeCharCode(char); _buffer.writeCharCode(char);
afterNewline = false;
break; break;
} }
} }