Skip to content

Better parsing of unknown at rule #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Sabberworm\CSS\RuleSet;
namespace Sabberworm\CSS\CSSList;

/**
* A RuleSet constructed by an unknown @-rule. @font-face rules are rendered into AtRule objects.
*/
class AtRule extends RuleSet {
class AtRule extends CSSBlockList {

private $sType;

Expand All @@ -25,4 +25,4 @@ public function __toString() {
return $sResult;
}

}
}
5 changes: 3 additions & 2 deletions lib/Sabberworm/CSS/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Sabberworm\CSS;

use Sabberworm\CSS\CSSList\AtRule;
use Sabberworm\CSS\CSSList\CSSList;
use Sabberworm\CSS\CSSList\Document;
use Sabberworm\CSS\CSSList\MediaQuery;
use Sabberworm\CSS\CSSList\KeyFrame;
use Sabberworm\CSS\Property\Import;
use Sabberworm\CSS\Property\Charset;
use Sabberworm\CSS\Property\CSSNamespace;
use Sabberworm\CSS\RuleSet\AtRule;
use Sabberworm\CSS\RuleSet\DeclarationBlock;
use Sabberworm\CSS\Value\CSSFunction;
use Sabberworm\CSS\Value\RuleValueList;
Expand Down Expand Up @@ -133,10 +133,11 @@ private function parseAtRule() {
return new CSSNamespace($mUrl, $sPrefix);
} else {
//Unknown other at rule (font-face or such)
$sIdentifier .= rtrim(' ' . $this->consumeUntil('{'));
$this->consume('{');
$this->consumeWhiteSpace();
$oAtRule = new AtRule($sIdentifier);
$this->parseRuleSet($oAtRule);
$this->parseList($oAtRule);
return $oAtRule;
}
}
Expand Down