Skip to content

CSS parsing fails for calc expressions that match the W3C specification #197

Description

@jmussman

I Checked this in 2.41 and 2.42, I did not go back any farther. The parser does not accept correct calc expressions. Space after an operator is not accepted, although the spec says it has to be there. Parentheses are not expected but the spec defines them. I also tried a nested calc function in lieu of parentheses and that is rejected as well but defined in the spec. See section 11.1 for all of this.

I am not going to post the whole file. The CSS snippet has line numbers to match the warnings:

40: min-height: calc(100vh - 150px + 10px + 21px + 20pt);
366: left: calc((100vw - 600px) / 2);
367: top: calc((100vh - 100px) / 2);

2020-07-25 18:44:43.716 WARN 7545 --- [pool-3-thread-1] c.g.htmlunit.DefaultCssErrorHandler : CSS error: 'http://localhost:57928/tccc/style/application.css' [40:29] Error in expression. (Invalid token " ". Was expecting one of: , "inherit", , , , , , , <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <RESOLUTION_DPI>, <RESOLUTION_DPCM>, , , <UNICODE_RANGE>, , , "progid:".)
2020-07-25 18:44:43.719 WARN 7545 --- [pool-3-thread-1] c.g.htmlunit.DefaultCssErrorHandler : CSS error: 'http://localhost:57928/tccc/style/application.css' [366:16] Error in expression. (Invalid token "(". Was expecting one of: , , "inherit", , , ")", "-", , , , , , <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <RESOLUTION_DPI>, <RESOLUTION_DPCM>, , , <UNICODE_RANGE>, , , "progid:".)
2020-07-25 18:44:43.720 WARN 7545 --- [pool-3-thread-1] c.g.htmlunit.DefaultCssErrorHandler : CSS error: 'http://localhost:57928/tccc/style/application.css' [367:15] Error in expression. (Invalid token "(". Was expecting one of: , , "inherit", , , ")", "-", , , , , , <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <RESOLUTION_DPI>, <RESOLUTION_DPCM>, , , <UNICODE_RANGE>, , , "progid:".)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions