w3c / css-validator

W3C CSS Validation Service
https://jigsaw.w3.org/css-validator/
Other
204 stars 105 forks source link

False errors "The types are incompatible" and "Invalid type" #399

Open 1jj opened 1 year ago

1jj commented 1 year ago

Hello!

Code like this gives wrong error messages (IMHO):

x { --y:  max(1 * var(--a), var(--b)) }     /* "The types are incompatible" */

x { --y:  max(var(--c), 1 * var(--d)) }     /* "Invalid type" */

x { --y:  max(2 * var(--e), var(--f)) }     /* "The types are incompatible" */

x { --y:  max(var(--g), var(--h) * 1) }     /* "Invalid type" */

x { --y:  max(-1 * var(--h)) }        /* (sometimes?) "Invalid type" */

Testcase from above: https://peter-hindelang.de/x.css Real-world example: https://peter-hindelang.de/Bilder/style.css

Thanks! j.j.

ylafon commented 1 year ago

It is indeed related to handling variable types, which has been done in calc() but not here.

ylafon commented 1 year ago

Note that having default value (then types) is a way to temporarily fix this. x { --y: max(1 * var(--a, 2em), var(--b, 42px)) } is shown as valid as the defaulted types are matching.

1jj commented 1 year ago

https://peter-hindelang.de/Bilder/style.css ... btw and while we are here: At least @font-face { size-adjust: ... } and probably poiner-events: none shouldn't be errors.

Edit: I see now that "pointer-events" depends on profile.