Skip to content

Commit 7a16ac6

Browse files
committed
Comma-separator has highest precedence with funcs
Previously, we gave spaces a higher precedence. This yielded some unexpected results in the parsed structure (but it does not affect rendered output)
1 parent a0e60f7 commit 7a16ac6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Sabberworm/CSS/Parser.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ private function parseIdentifier($bAllowFunctions = true) {
156156
}
157157
if ($bAllowFunctions && $this->comes('(')) {
158158
$this->consume('(');
159-
$sResult = new CSSFunction($sResult, $this->parseValue(array('=', ',', ' ')));
159+
$aArguments = $this->parseValue(array('=', ' ', ','));
160+
$sResult = new CSSFunction($sResult, $aArguments);
160161
$this->consume(')');
161162
}
162163
return $sResult;
@@ -279,6 +280,7 @@ private function parseRule() {
279280
private function parseValue($aListDelimiters) {
280281
$aStack = array();
281282
$this->consumeWhiteSpace();
283+
//Build a list of delimiters and parsed values
282284
while (!($this->comes('}') || $this->comes(';') || $this->comes('!') || $this->comes(')'))) {
283285
if (count($aStack) > 0) {
284286
$bFoundDelimiter = false;
@@ -298,6 +300,7 @@ private function parseValue($aListDelimiters) {
298300
array_push($aStack, $this->parsePrimitiveValue());
299301
$this->consumeWhiteSpace();
300302
}
303+
//Convert the list to list objects
301304
foreach ($aListDelimiters as $sDelimiter) {
302305
if (count($aStack) === 1) {
303306
return $aStack[0];

0 commit comments

Comments
 (0)