@@ -325,7 +325,7 @@ export class Parser {
325325 || this . _parseViewPort ( )
326326 || this . _parseNamespace ( )
327327 || this . _parseDocument ( )
328- || this . _parseContainer ( )
328+ || this . _parseContainer ( isNested )
329329 || this . _parseUnknownAtRule ( ) ;
330330 }
331331
@@ -365,6 +365,7 @@ export class Parser {
365365 return this . _parseMedia ( true )
366366 || this . _parseSupports ( true )
367367 || this . _parseLayer ( true )
368+ || this . _parseContainer ( true )
368369 || this . _parseUnknownAtRule ( ) ;
369370 }
370371
@@ -1296,8 +1297,15 @@ export class Parser {
12961297 this . resync ( [ ] , [ TokenType . CurlyL ] ) ; // ignore all the rules
12971298 return this . _parseBody ( node , this . _parseStylesheetStatement . bind ( this ) ) ;
12981299 }
1300+ public _parseContainerDeclaration ( isNested = false ) : nodes . Node | null {
1301+ if ( isNested ) {
1302+ // if nested, the body can contain rulesets, but also declarations
1303+ return this . _tryParseRuleset ( true ) || this . _tryToParseDeclaration ( ) || this . _parseStylesheetStatement ( true ) ;
1304+ }
1305+ return this . _parseStylesheetStatement ( false ) ;
1306+ }
12991307
1300- public _parseContainer ( ) : nodes . Node | null {
1308+ public _parseContainer ( isNested : boolean = false ) : nodes . Node | null {
13011309 if ( ! this . peekKeyword ( '@container' ) ) {
13021310 return null ;
13031311 }
@@ -1307,7 +1315,7 @@ export class Parser {
13071315 node . addChild ( this . _parseIdent ( ) ) ; // optional container name
13081316 node . addChild ( this . _parseContainerQuery ( ) ) ;
13091317
1310- return this . _parseBody ( node , this . _parseStylesheetStatement . bind ( this ) ) ;
1318+ return this . _parseBody ( node , this . _parseContainerDeclaration . bind ( this , isNested ) ) ;
13111319 }
13121320
13131321 public _parseContainerQuery ( ) : nodes . Node | null {
0 commit comments