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].
void _visitUnquotedString(String string) {
var afterNewline = false;
for (var i = 0; i < string.length; i++) {
var char = string.codeUnitAt(i);
switch (char) {
case $lf:
_buffer.writeCharCode($space);
afterNewline = true;
break;
case $space:
if (!afterNewline) _buffer.writeCharCode($space);
break;
default:
_buffer.writeCharCode(char);
afterNewline = false;
break;
}
}