PHP-CSS-Parser icon indicating copy to clipboard operation
PHP-CSS-Parser copied to clipboard

Required trailing space after ` or ` conditional within at-rule is removed

Open cjholowatyj opened this issue 4 years ago • 1 comments

My origin CSS has some @supports at-rules, and inside the conditional statement of these rules there are some or statements, for example: @supports ((-webkit-transform-style:preserve-3d) or (transform-style:preserve-3d)){}

When I run the following code (assuming $originalStyleContent contains a string of CSS being processed) the space that follows the or operator is missing:

$cssParser = new Sabberworm\CSS\Parser($originalStyleContent);
$originCSS=$cssParser->parse();
$outputString.=$originCSS->render(Sabberworm\CSS\OutputFormat::createCompact());

results in... @supports ((-webkit-transform-style:preserve-3d) or(transform-style:preserve-3d)){}

Maybe I'm wrong (because my knowledge of CSS does have it's limits) but this missing space seems to be the culprit behind other operations on my development environment not being able to parse the resulting CSS. Can you confirm that this missing space is in fact necessary and needs to be present post-render?

cjholowatyj avatar Mar 21 '20 00:03 cjholowatyj

It’s possible we falsely parse or (transform-style:preserve-3d) as a function but I’m not sure as I don’t know the code path used for @supports, will need to investigate.

sabberworm avatar Mar 23 '20 10:03 sabberworm