sabberworm / PHP-CSS-Parser

A Parser for CSS Files written in PHP. Allows extraction of CSS files into a data structure, manipulation of said structure and output as (optimized) CSS

Home Page:http://www.sabberworm.com/blog/2010/6/10/php-css-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

cjholowatyj opened this issue · 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?

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.

ezoic increase your site revenue