Skip to content

Commit 1051a87

Browse files
committed
Check don’t be too vendor-specific
we don’t yet know the vendors still to come
1 parent 7819fdd commit 1051a87

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/Sabberworm/CSS/Parser.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,7 @@ private function parseAtRule() {
8989
$this->consume('@');
9090
$sIdentifier = $this->parseIdentifier();
9191
$this->consumeWhiteSpace();
92-
if($sIdentifier == '-webkit-keyframes' || $sIdentifier == '-moz-keyframes' || $sIdentifier == '-ms-keyframes' || $sIdentifier == '-o-keyframes' || $sIdentifier == 'keyframes') {
93-
$oResult = new KeyFrame();
94-
$oResult->setVendorKeyFrame($sIdentifier);
95-
$oResult->setAnimationName(trim($this->consumeUntil('{')));
96-
$this->consume('{');
97-
$this->consumeWhiteSpace();
98-
$this->parseList($oResult);
99-
return $oResult;
100-
101-
} else if ($sIdentifier === 'media') {
92+
if ($sIdentifier === 'media') {
10293
$oResult = new MediaQuery();
10394
$oResult->setQuery(trim($this->consumeUntil('{')));
10495
$this->consume('{');
@@ -120,6 +111,14 @@ private function parseAtRule() {
120111
$this->consume(';');
121112
$this->setCharset($sCharset->getString());
122113
return new Charset($sCharset);
114+
} else if(preg_match('/^(-\\w+-)?keyframes$/', $sIdentifier) === 1) {
115+
$oResult = new KeyFrame();
116+
$oResult->setVendorKeyFrame($sIdentifier);
117+
$oResult->setAnimationName(trim($this->consumeUntil('{')));
118+
$this->consume('{');
119+
$this->consumeWhiteSpace();
120+
$this->parseList($oResult);
121+
return $oResult;
123122
} else {
124123
//Unknown other at rule (font-face or such)
125124
$this->consume('{');

0 commit comments

Comments
 (0)