w3c / css-validator

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

Media query causes unexpected parse error #406

Closed schliflo closed 4 months ago

schliflo commented 11 months ago

Firstly thanks for this incredibly useful tool!

I think I found a bug when using a specific media query:

This code produces a Parse Error:

@media (-webkit-min-device-pixel-ratio: 1.5) and (min-width: 320px), (min-resolution: 144dpi) and (min-width: 320px) {
    body {
        color: red
    }
}

while prefixing the same query with any media type like all and it is considered valid:

@media all and (-webkit-min-device-pixel-ratio: 1.5) and (min-width: 320px), (min-resolution: 144dpi) and (min-width: 320px) {
    body {
        color: red
    }
}

I think both versions should be valid, as the all media type is implicitly implied when omitted as in my first snippet: https://developer.mozilla.org/en-US/docs/Web/CSS/@media#media_types

ylafon commented 11 months ago

This is most probably due to the fact that vendor extensions are not checked, so `@​media and (...) will fail. Indeed a bug