Skip to content

Support CSS3 calc() #79

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
mikkorantalainen opened this issue Jul 3, 2014 · 9 comments
Closed

Support CSS3 calc() #79

mikkorantalainen opened this issue Jul 3, 2014 · 9 comments

Comments

@mikkorantalainen
Copy link

Following document throws Sabberworm\CSS\Parsing\UnexpectedTokenException with message Identifier expected. Got “+ 20p”. This is expected to be valid CSS document:

body
{
    border-top: solid green 0em;
    border-top-width: calc(1em + 20px);
}

The parser is initialized like this:

$settings = Sabberworm\CSS\Settings::create();
$settings->beStrict();
$parser = new Sabberworm\CSS\Parser($css, $settings);

I think Parser::parseValue() would need to be modified but I have no idea how to fix this.

@sabberworm sabberworm changed the title Support for calc() Support CSS3 calc() Jul 3, 2014
@sabberworm
Copy link
Collaborator

I think it’s better to add a ValueList subclass Calc which would take care to output spaces around the + and - signs instead of trying to hack calc() on top of CSSFunction. Parsing should not be too hard, either. Also, since calc()s can include parenthesized subexpressions, there’d need to be another storage class for these.

@bestplay9384
Copy link

bestplay9384 commented Jul 27, 2016

hey, is there any change calc() handle will be added to the parser?

@ivanraz
Copy link

ivanraz commented Oct 13, 2016

Hi there,
We found an issue when using multiplication inside the calc function.

For example, we got this line in our .less file:
right: calc(~"-1*(100% - 54px)");

The parser hits an exception when it goes over the * character.

@axute
Copy link

axute commented Dec 21, 2017

is there any news?
we have the same issues with calc()

@sabberworm
Copy link
Collaborator

I don’t have time to work on this now or in the near future but pull-requests are always welcome.

@raxbg
Copy link
Contributor

raxbg commented Jul 3, 2018

Can this be closed now?

@axute
Copy link

axute commented Jul 3, 2018

we don't use it anymore :-\

@sabberworm
Copy link
Collaborator

sabberworm commented Jul 3, 2018 via email

@sabberworm
Copy link
Collaborator

Released with 8.2.0

raxbg pushed a commit to raxbg/PHP-CSS-Parser that referenced this issue Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants