@@ -69,8 +69,9 @@ public static function parseList(ParserState $oParserState, CSSList $oList)
6969 $ oParserState = new ParserState ($ oParserState , Settings::create ());
7070 }
7171 $ bLenientParsing = $ oParserState ->getSettings ()->bLenientParsing ;
72+ $ aComments = [];
7273 while (!$ oParserState ->isEnd ()) {
73- $ comments = $ oParserState ->consumeWhiteSpace ();
74+ $ aComments = array_merge ( $ aComments , $ oParserState ->consumeWhiteSpace () );
7475 $ oListItem = null ;
7576 if ($ bLenientParsing ) {
7677 try {
@@ -86,11 +87,12 @@ public static function parseList(ParserState $oParserState, CSSList $oList)
8687 return ;
8788 }
8889 if ($ oListItem ) {
89- $ oListItem ->setComments ( $ comments );
90+ $ oListItem ->addComments ( $ aComments );
9091 $ oList ->append ($ oListItem );
9192 }
92- $ oParserState ->consumeWhiteSpace ();
93+ $ aComments = $ oParserState ->consumeWhiteSpace ();
9394 }
95+ $ oList ->addComments ($ aComments );
9496 if (!$ bIsRoot && !$ bLenientParsing ) {
9597 throw new SourceException ("Unexpected end of document " , $ oParserState ->currentLine ());
9698 }
@@ -125,7 +127,7 @@ private static function parseListItem(ParserState $oParserState, CSSList $oList)
125127 $ oParserState ->currentLine ()
126128 );
127129 }
128- $ oParserState ->setCharset ($ oAtRule ->getCharset ()-> getString () );
130+ $ oParserState ->setCharset ($ oAtRule ->getCharset ());
129131 }
130132 return $ oAtRule ;
131133 } elseif ($ oParserState ->comes ('} ' )) {
@@ -172,10 +174,10 @@ private static function parseAtRule(ParserState $oParserState)
172174 $ oParserState ->consumeUntil (['; ' , ParserState::EOF ], true , true );
173175 return new Import ($ oLocation , $ sMediaQuery ?: null , $ iIdentifierLineNum );
174176 } elseif ($ sIdentifier === 'charset ' ) {
175- $ sCharset = CSSString::parse ($ oParserState );
177+ $ oCharsetString = CSSString::parse ($ oParserState );
176178 $ oParserState ->consumeWhiteSpace ();
177179 $ oParserState ->consumeUntil (['; ' , ParserState::EOF ], true , true );
178- return new Charset ($ sCharset , $ iIdentifierLineNum );
180+ return new Charset ($ oCharsetString , $ iIdentifierLineNum );
179181 } elseif (self ::identifierIs ($ sIdentifier , 'keyframes ' )) {
180182 $ oResult = new KeyFrame ($ iIdentifierLineNum );
181183 $ oResult ->setVendorKeyFrame ($ sIdentifier );
@@ -402,7 +404,7 @@ public function __toString()
402404 /**
403405 * @return string
404406 */
405- public function render (OutputFormat $ oOutputFormat )
407+ protected function renderListContents (OutputFormat $ oOutputFormat )
406408 {
407409 $ sResult = '' ;
408410 $ bIsFirst = true ;
0 commit comments