From 88267b1c68c0f3225a4cf5ee587e7d37e404d49d Mon Sep 17 00:00:00 2001 From: Jake Dallimore Date: Fri, 1 Nov 2019 13:21:17 +0800 Subject: [PATCH] MDL-67097 libraries: fix comment parsing in php-css-parser library This fixes a bug when parsing the following rule-level and list-level comments. div {/*rtl:ignore*/left:10px;/*rtl:ignore*/ display:inline;} /*rtl:ignore*/div {left:10px;} /*rtl:ignore*/ a {left:10px} The latter rtl directive was being swallowed by the parser in these cases and was not being properly allocated as a property of the rule or csslist. This restores the correct behaviour of the rtlcss library, which depends on php-css-parser. --- lib/php-css-parser/CSSList/CSSList.php | 1 - lib/php-css-parser/Rule/Rule.php | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/php-css-parser/CSSList/CSSList.php b/lib/php-css-parser/CSSList/CSSList.php index bf4efcb7827..11e1dcc8259 100644 --- a/lib/php-css-parser/CSSList/CSSList.php +++ b/lib/php-css-parser/CSSList/CSSList.php @@ -61,7 +61,6 @@ abstract class CSSList implements Renderable, Commentable { $oListItem->setComments($comments); $oList->append($oListItem); } - $oParserState->consumeWhiteSpace(); } if(!$bIsRoot && !$bLenientParsing) { throw new SourceException("Unexpected end of document", $oParserState->currentLine()); diff --git a/lib/php-css-parser/Rule/Rule.php b/lib/php-css-parser/Rule/Rule.php index 3fa031bd639..4480948f488 100644 --- a/lib/php-css-parser/Rule/Rule.php +++ b/lib/php-css-parser/Rule/Rule.php @@ -56,7 +56,6 @@ class Rule implements Renderable, Commentable { while ($oParserState->comes(';')) { $oParserState->consume(';'); } - $oParserState->consumeWhiteSpace(); return $oRule; }