@@ -916,7 +916,7 @@ function parseerror(s, msg) {
916
916
return true ;
917
917
}
918
918
919
- function consumeAListOfRules ( s , topLevel = false ) {
919
+ function consumeAStylesheetsContents ( s ) {
920
920
const rules = [ ] ;
921
921
while ( 1 ) {
922
922
const token = s . nextToken ( ) ;
@@ -925,12 +925,7 @@ function consumeAListOfRules(s, topLevel=false) {
925
925
} else if ( token instanceof EOFToken ) {
926
926
return rules ;
927
927
} else if ( token instanceof CDOToken || token instanceof CDCToken ) {
928
- if ( topLevel == "top-level" ) {
929
- s . discardToken ( ) ;
930
- } else {
931
- const rule = consumeAQualifiedRule ( s ) ;
932
- if ( rule ) rules . push ( rule ) ;
933
- }
928
+ s . discardToken ( ) ;
934
929
} else if ( token instanceof AtKeywordToken ) {
935
930
const rule = consumeAnAtRule ( s )
936
931
if ( rule ) rules . push ( rule ) ;
@@ -1207,13 +1202,18 @@ function normalizeInput(input) {
1207
1202
function parseAStylesheet ( s ) {
1208
1203
s = normalizeInput ( s ) ;
1209
1204
var sheet = new Stylesheet ( ) ;
1210
- sheet . rules = consumeAListOfRules ( s , "top-level" ) ;
1205
+ sheet . rules = consumeAStylesheetsContents ( s ) ;
1211
1206
return sheet ;
1212
1207
}
1213
1208
1214
- function parseAListOfRules ( s ) {
1209
+ function parseAStylesheetsContents ( s ) {
1210
+ s = normalizeInput ( s ) ;
1211
+ return consumeAStylesheetsContents ( s ) ;
1212
+ }
1213
+
1214
+ function parseABlocksContents ( s ) {
1215
1215
s = normalizeInput ( s ) ;
1216
- return consumeAListOfRules ( s ) ;
1216
+ return consumeABlocksContents ( s ) ;
1217
1217
}
1218
1218
1219
1219
function parseARule ( s ) {
@@ -1385,7 +1385,8 @@ exports.Declaration = Declaration;
1385
1385
exports . SimpleBlock = SimpleBlock ;
1386
1386
exports . Func = Func ;
1387
1387
exports . parseAStylesheet = parseAStylesheet ;
1388
- exports . parseAListOfRules = parseAListOfRules ;
1388
+ exports . parseAStylesheetsContents = parseAStylesheetsContents ;
1389
+ exports . parseABlocksContents = parseABlocksContents ;
1389
1390
exports . parseARule = parseARule ;
1390
1391
exports . parseADeclaration = parseADeclaration ;
1391
1392
exports . parseAComponentValue = parseAComponentValue ;
0 commit comments