Skip to content
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

[css-values-4] Recursive math functions are inconsistently specified #8664

Closed
AtkinsSJ opened this issue Mar 31, 2023 · 3 comments
Closed

[css-values-4] Recursive math functions are inconsistently specified #8664

AtkinsSJ opened this issue Mar 31, 2023 · 3 comments

Comments

@AtkinsSJ
Copy link
Contributor

The spec about math functions is a bit inconsistent, at least from what I can tell. Each math function is described as allowing a calculation for its parameters, but that links specifically to the calc() definition, whereas the examples show that other math functions are allowed there. The syntax description does not itself allow any function (including calc()) to appear as a parameter to another math function.

So the issues here are:

  • The syntax should allow for math functions as part of <calc-value>.
  • The places that currently link to calculation should link elsewhere. The usage of calculation includes literal numbers or values, and math functions, as well as calc-like expressions. (Which generally corresponds to <calc-value>.)
@AtkinsSJ
Copy link
Contributor Author

This is also a problem with the previous, simpler definition from CSS-VALUES-3. Strictly following the given syntax means that calc(3 + calc(4 * 2)) is invalid, when it should be valid.

@tabatkins
Copy link
Member

Each math function is described as allowing a calculation for its parameters, but that links specifically to the calc() definition, whereas the examples show that other math functions are allowed there.

Specifically, they link to the "calculation" definition, which happens to be placed in the section defining calc(); they're not linking to calc() itself. The definition is not calc()-specific; it describes the argument to calc() (and the other math functions): "a sequence of values interspersed with operators, and possibly grouped by parentheses (matching the <calc-sum> grammar)"

The syntax description does not itself allow any function (including calc()) to appear as a parameter to another math function.

They do. All the grammar definitions eventually bottom out in <calc-value>, which is <number>/<dimension>/etc. Math functions match those productions based on what they contain, as specified in Type Checking.

@AtkinsSJ
Copy link
Contributor Author

AtkinsSJ commented Apr 3, 2023

Thank you! And sorry about that. 😅

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

2 participants