Re: CSS Validator Bug - A big one

28.10.2011 8:20, Brian wrote:

>     Love the site and resources, but there's a pretty big problem with
> your CSS validator.  It shows sites with NO CSS as being CSS 2.1 valid
> with no errors.

An empty stylesheet is a valid CSS stylesheet. So formally at least the 
report is correct, though somewhat odd in this case. In particular, the 
suggestion about "Valid CSS!" icon looks even ridiculous. But the 
message clearly has the text "No style sheet found", though just at the end.

 > Having no CSS is quite a bit different from having
> CSS with no errors.

Indeed, and having no stylesheet is logically different from having an 
empty stylesheet.

I'm afraid the internal structure of the W3C CSS Validator makes it hard 
to build more logic into it, even if the logic itself would be simple. 
(Just a half-educated guess; I don't know the structure.)

But if it is possible to add such logic, I would suggest the following:

1) If no stylesheet is found (an HTML file is submitted and it does not 
contain any style element or style attribute or link element referring 
to a stylesheet), then the message "No stylesheet found" is given, with 
little or no other information.

2) If some stylesheets are found but they are all empty, then the 
message "Only empty stylesheet(s) found" is issued, with little or no 
other information.

This is not a big issue though. The W3C CSS Validator is meant for 
authors who wish to check their stylesheets. They normally use 
stylesheets on all pages, and if they exceptionally don't, they probably 
know about the situation. But diagnostics like the above would be useful 
to detect problems when
a) the external CSS file referred to exists but is accidentally empty
b) the author has just <style></style> or style="" and he had intended 
to insert a style sheet there but forgot.
(On such grounds, actually, it might be useful to issue an informative 
message about _any_ empty stylesheet.=


Received on Friday, 28 October 2011 13:04:07 UTC