css-validator icon indicating copy to clipboard operation
css-validator copied to clipboard

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

Open 1jj opened this issue 2 years ago • 3 comments

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.

1jj avatar Apr 18 '23 20:04 1jj

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

ylafon avatar Apr 19 '23 05:04 ylafon

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.

ylafon avatar Apr 19 '23 05:04 ylafon

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.

1jj avatar Apr 19 '23 11:04 1jj