$input = <<<CSS
a {
/* margin: 10px 10px 10px 0; */
outline: none;
}
CSS;
$document = (new \Sabberworm\CSS\Parser($input))
->parse();
$format = OutputFormat::createPretty();
echo $document->render($format);
becomes:
a {
/* margin: 10px 10px 10px 0; */
outline: none;
}
while if you update the input to remove the outline property,
a {
/* margin: 10px 10px 10px 0; */
}
it becomes:
so any commented rule(s) not followed by a CSS rule are removed from the resulting rule set.
Problem occurs here because getRules() returns an empty array
|
foreach ($this->getRules() as $rule) { |
becomes:
while if you update the input to remove the outline property,
it becomes:
a {}so any commented rule(s) not followed by a CSS rule are removed from the resulting rule set.
Problem occurs here because getRules() returns an empty array
PHP-CSS-Parser/src/RuleSet/RuleSet.php
Line 308 in 0ae1fde