Skip to content

Parse escaped URL and Calc functions correctly #174

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

Conversation

raxbg
Copy link
Contributor

@raxbg raxbg commented Nov 12, 2019

Resolves #170. Thanks to @mtsvetkov for this PR.

if ($sResult == 'url') {
$sResult = new URL($aArguments, $oParserState->currentLine());
} else if ($sResult == 'calc') {
$sResult = new CalcFunction($sResult, $aArguments, ',', $oParserState->currentLine());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure we support -webkit-calc, -moz-calc, etc here too.

Comment on lines +72 to +79
if ($sResult == 'url') {
$sResult = new URL($aArguments, $oParserState->currentLine());
} else if ($sResult == 'calc') {
$sResult = new CalcFunction($sResult, $aArguments, ',', $oParserState->currentLine());
} else {
$sResult = new CSSFunction($sResult, $aArguments, ',', $oParserState->currentLine());
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we unify this with the logic from parsePrimitiveValue (i.e. drop the duplicate code and URL::parse and CalcFunction::parse)?

@raxbg raxbg mentioned this pull request Nov 13, 2019
raxbg added a commit to raxbg/PHP-CSS-Parser that referenced this pull request Nov 13, 2019
@raxbg raxbg closed this Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function name with escaping not properly recognized
2 participants