You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: no-invalid-properties does not validate calc() contents #501
All six declarations reported as invalid. In particular:
calc(red), calc(), calc(1px + ) and calc(1px ** 2px) do not match the <calc-sum> grammar at all.
calc(1px+2px) is invalid per CSS Values and Units: "White space is required on both sides of the + and - operators." (1px+2px tokenizes as the two dimensions 1px and +2px with no operator between them.)
Browsers agree and drop all six declarations.
What actually happened?
Only the unwrapped width: red is reported. Every calc() variant passes:
I am willing to submit a pull request for this issue.
AI acknowledgment
I did not use AI to generate this issue report.
(If the above is not checked) I have reviewed the AI-generated content before submitting.
Additional comments
It looks like math function contents are treated as opaque during value matching (possibly on the @eslint/css-tree side), i.e. a calc() is accepted wherever a numeric type is expected without checking its operands or operators.
As you said we use csstree for the matching and its tool csstree/validator reports for the same cases.
The browser drops the declarations not because calc evaluates to an invalid value but because it does not match the calc() syntax.
As such I would see this as a new rule to validate functions with specific syntax (such as calc).
Activity
DMartens commentedon Jul 13, 2026
As you said we use
csstreefor the matching and its toolcsstree/validatorreports for the same cases.The browser drops the declarations not because
calcevaluates to an invalid value but because it does not match thecalc() syntax.As such I would see this as a new rule to validate functions with specific syntax (such as
calc).przemyslaw-zan commentedon Jul 14, 2026
In this case, prior art with part of the functionality:
DMartens commentedon Jul 14, 2026
This is not prior art as it is purely a stylistic rule enforcing spacing around the operators and not checking the syntax as proposed here.
przemyslaw-zan commentedon Jul 14, 2026
The issue I've made contains explanation that in this case
calcis whitespace sensitve, thus this is not stylistic issue but a validity one.