From 534860dffe334bbccd8b88af6047ead350cfaf82 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 19 Mar 2013 01:10:28 -0600 Subject: [PATCH] Fix parsing negative numeric arguments without a leading digit E.g. this: -.5em Was being parsed/output as - 0.5em --- lib/Sabberworm/CSS/Parser.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Sabberworm/CSS/Parser.php b/lib/Sabberworm/CSS/Parser.php index 5a55ba2f7..853529261 100644 --- a/lib/Sabberworm/CSS/Parser.php +++ b/lib/Sabberworm/CSS/Parser.php @@ -350,7 +350,10 @@ private static function listDelimiterForRule($sRule) { private function parsePrimitiveValue() { $oValue = null; $this->consumeWhiteSpace(); - if (is_numeric($this->peek()) || (($this->comes('-') || $this->comes('.')) && is_numeric($this->peek(1, 1)))) { + if (is_numeric($this->peek()) || + (($this->comes('-') || $this->comes('.')) && + (($peek = $this->peek(1, 1)) || true) && + (($peek == '.') || is_numeric($peek)))) { $oValue = $this->parseNumericValue(); } else if ($this->comes('#') || $this->comes('rgb') || $this->comes('hsl')) { $oValue = $this->parseColorValue();