File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -1276,19 +1276,21 @@ class AtRule extends CSSParserRule {
1276
1276
}
1277
1277
toSource ( indent = 0 ) {
1278
1278
let s = printIndent ( indent ) + "@" + escapeIdent ( this . name ) ;
1279
- s += this . prelude . map ( x => x . toSource ( ) ) . join ( "" ) ;
1280
- if ( this . declarations == null ) {
1281
- s += ";\n" ;
1279
+ let prelude = this . prelude . map ( x => x . toSource ( ) ) . join ( "" ) ;
1280
+ while ( prelude . endsWith ( ' ' ) ) { prelude = prelude . slice ( 0 , - 1 ) ; }
1281
+ if ( this . declarations === null ) {
1282
+ s += prelude + ";" ;
1282
1283
return s ;
1283
1284
}
1284
- s += "{\n" ;
1285
- if ( this . declarations . length ) {
1286
- s += this . declarations . map ( x => x . toSource ( indent + 1 ) ) . join ( "\n" ) + "\n" ;
1287
- }
1288
- if ( this . rules . length ) {
1289
- s += this . rules . map ( x => x . toSource ( indent + 1 ) ) . join ( "\n" ) + "\n" ;
1285
+ s += prelude + " " ;
1286
+ if ( this . declarations . length || this . rules . length ) {
1287
+ s += "{\n" +
1288
+ this . declarations . map ( x => x . toSource ( indent + 1 ) + "\n" ) . join ( "" ) +
1289
+ this . rules . map ( x => x . toSource ( indent + 1 ) + "\n" ) . join ( "" ) +
1290
+ printIndent ( indent ) + "}" ;
1291
+ } else {
1292
+ s += "{ }" ;
1290
1293
}
1291
- s += printIndent ( indent ) + "}" ;
1292
1294
return s ;
1293
1295
}
1294
1296
}
You can’t perform that action at this time.
0 commit comments