diff --git a/lib/Sabberworm/CSS/Value/CSSString.php b/lib/Sabberworm/CSS/Value/CSSString.php index 9f9c050e..0b5de51c 100644 --- a/lib/Sabberworm/CSS/Value/CSSString.php +++ b/lib/Sabberworm/CSS/Value/CSSString.php @@ -15,13 +15,17 @@ public function __construct($sString, $iLineNo = 0) { } public static function parse(ParserState $oParserState) { - $sBegin = $oParserState->peek(); + $sBegin = $oParserState->peek(2); $sQuote = null; - if ($sBegin === "'") { + if ($sBegin[0] === "'") { $sQuote = "'"; - } else if ($sBegin === '"') { + } elseif ($sBegin[0] === '"') { $sQuote = '"'; - } + } elseif ($sBegin === '\"') { + $sQuote = '\"'; + } elseif ($sBegin === "\'") { + $sQuote = "\'"; + } if ($sQuote !== null) { $oParserState->consume($sQuote); } diff --git a/lib/Sabberworm/CSS/Value/Value.php b/lib/Sabberworm/CSS/Value/Value.php index fccc26bb..0b8c8711 100644 --- a/lib/Sabberworm/CSS/Value/Value.php +++ b/lib/Sabberworm/CSS/Value/Value.php @@ -18,14 +18,14 @@ public static function parseValue(ParserState $oParserState, $aListDelimiters = $oParserState->consumeWhiteSpace(); //Build a list of delimiters and parsed values while (!($oParserState->comes('}') || $oParserState->comes(';') || $oParserState->comes('!') || $oParserState->comes(')') || $oParserState->comes('\\'))) { - if (count($aStack) > 0) { + if (count($aStack) > 0) { $bFoundDelimiter = false; foreach ($aListDelimiters as $sDelimiter) { if ($oParserState->comes($sDelimiter)) { - array_push($aStack, $oParserState->consume($sDelimiter)); - $oParserState->consumeWhiteSpace(); - $bFoundDelimiter = true; - break; + array_push($aStack, $oParserState->consume($sDelimiter)); + $oParserState->consumeWhiteSpace(); + $bFoundDelimiter = true; + break; } } if (!$bFoundDelimiter) { @@ -86,7 +86,7 @@ public static function parsePrimitiveValue(ParserState $oParserState) { $oValue = URL::parse($oParserState); } else if ($oParserState->comes('calc', true) || $oParserState->comes('-webkit-calc', true) || $oParserState->comes('-moz-calc', true)) { $oValue = CalcFunction::parse($oParserState); - } else if ($oParserState->comes("'") || $oParserState->comes('"')) { + } else if ($oParserState->comes("'") || $oParserState->comes('"') || $oParserState->comes("\'") || $oParserState->comes('\"')) { $oValue = CSSString::parse($oParserState); } else if ($oParserState->comes("progid:") && $oParserState->getSettings()->bLenientParsing) { $oValue = self::parseMicrosoftFilter($oParserState);