From 30b76fed65621afe07feebc26f539b09fe408023 Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Tue, 4 Sep 2012 11:44:53 +0200 Subject: [PATCH 1/3] added @namespace rule support --- lib/Sabberworm/CSS/Parser.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/Sabberworm/CSS/Parser.php b/lib/Sabberworm/CSS/Parser.php index e32eb808..dae0cd4e 100644 --- a/lib/Sabberworm/CSS/Parser.php +++ b/lib/Sabberworm/CSS/Parser.php @@ -110,6 +110,20 @@ private function parseAtRule() { $this->consume(';'); $this->setCharset($sCharset->getString()); return new Charset($sCharset); + } else if ($sIdentifier === 'namespace') { + $this->consumeWhiteSpace(); + + if ($this->comes('"')) { + $prefix = ""; + $namespace = $this->parseStringValue()->getString(); + + }else{ + $prefix = $this->parseIdentifier(false); + $this->consumeWhiteSpace(); + $namespace = $this->parseStringValue()->getString(); + } + $this->consume(';'); + return new CssNamespace($namespace, $prefix); } else { //Unknown other at rule (font-face or such) $this->consume('{'); From acdfc7dc66e19c494dc51d87fed3567ec9d897bb Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Tue, 4 Sep 2012 11:47:03 +0200 Subject: [PATCH 2/3] added @namespace rule support --- lib/Sabberworm/CSS/Property/CssNamespace.php | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/Sabberworm/CSS/Property/CssNamespace.php diff --git a/lib/Sabberworm/CSS/Property/CssNamespace.php b/lib/Sabberworm/CSS/Property/CssNamespace.php new file mode 100644 index 00000000..fabac2f3 --- /dev/null +++ b/lib/Sabberworm/CSS/Property/CssNamespace.php @@ -0,0 +1,37 @@ +sValue = $sValue; + $this->sPrefix = $sPrefix; + } + + public function __toString() { + return '@namespace '.$this->sPrefix.' "'.$this->sValue.'";'; + } + + public function getValue() { + return $this->sValue; + } + + public function getPrefix() { + return $this->sPrefix; + } + + public function setValue($sValue) { + $this->sValue = $sValue; + } + + public function setPrefix($sPrefix) { + $this->sPrefix = $sPrefix; + } + +} \ No newline at end of file From 1184fd7d598b2332282377739df3fcb83dc703ff Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Tue, 4 Sep 2012 11:55:48 +0200 Subject: [PATCH 3/3] fix use namespace --- lib/Sabberworm/CSS/Parser.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Sabberworm/CSS/Parser.php b/lib/Sabberworm/CSS/Parser.php index dae0cd4e..211709a5 100644 --- a/lib/Sabberworm/CSS/Parser.php +++ b/lib/Sabberworm/CSS/Parser.php @@ -2,6 +2,8 @@ namespace Sabberworm\CSS; +use Sabberworm\CSS\Property\CssNamespace; + use Sabberworm\CSS\CSSList\CSSList; use Sabberworm\CSS\CSSList\Document; use Sabberworm\CSS\CSSList\MediaQuery;