Re: Real problem caused by CSS validators willingness to tacitly accept HTML

Philip Taylor (Webmaster) wrote:

> 1) The CSS validator is asked to validate a non-existent CSS page
>
> http://jigsaw.w3.org/css-validator/validator?uri=http://www.rhul.ac.uk/resources/Stylesheets/CSS/TP-Common.css

Technically, it is asked to check a resource that does not exist. A 
nonexistent resource has no type, so we can't call it a non-existent CSS 
page.

> 2) The CSS Validator says that validation was successful, and
> displays the CSS.

To me, it says

Target: http://www.rhul.ac.uk/resources/Stylesheets/CSS/TP-Common.css
I/O Error: http://www.rhul.ac.uk/resources/Stylesheets/CSS/TP-Common.css: 
Not Found
which is not optimal (I'd prefer seeing a clear indication of the "Not 
Found" response, with the HTTP error code) but not incorrect either.

> The IIS is configured to serve a custom 404 (HTML) web
> page on encountering a 404,

That's fine, though the server is also configured to include nonsense in its 
response:

"The Web site you are trying to access has an IP address that is configured 
not to accept requests that specify a port number."

> and this page page links
> to a subtly different version of the CSS file intended
> to be specified at (1) above.

It seems that you have somehow encountered a situation where the W3C CSS 
Validator treats the error message page (accompanying the 404 response) as a 
response to the request. That would be a mistake, a protocol error, but I 
cannot construct the situation. _If_ it happens, the rest is natural, since 
the W3C CSS Validator is _supposed_ to handle HTML documents as well.

> This behaviour has
> now been changed to simplify urgent work here; it
> may be re-instated in due course,

Sorry, I don't follow.

> but attempts to
> replicate the problem will currently shew very different
> CSS between
>
> http://jigsaw.w3.org/css-validator/validator?uri=http://www.rhul.ac.uk/resources/Stylesheets/CSS/TP-Common.css
>
> and
>
> http://jigsaw.w3.org/css-validator/validator?uri=http://www.rhul.ac.uk/resources/Style-sheets/CSS/TP-Common.css

The former results in information about I/O error, the latter results in a 
report on checking CSS code. These behaviors seem to correct to me. They 
_must_ differ very much, since the former refers to a nonexistent resource 
and the latter to a stylesheet.

> Request : could the CSS validator /please/ report (very
> loudly !) if the returned resource is declared at
> HTTP level to be anything other than "text/css",

The W3C CSS Validator is capable of handling HTML documents as well, and 
this is a _very_ useful thing and should not be disturbed. If there is or 
was a problem, it was in the handling of HTTP error responses.

> and could it also please report if the served file
> appears not to be CSS but (say) HTML with CSS embedded
> or linked ?

I don't think there's a reason to make a noise about that, since it's 
intended behavior and clearly indicated in the user interface for submitting 
a URL for checking.

But admittedly the wording is slightly misleading when it says

"This document validates as CSS!"

for a document that is not a CSS stylesheet. An adequate statement would be 
something like

"The CSS style sheets included in the submitted document or referred to by 
it are syntactically correct."

-- 
Jukka K. Korpela ("Yucca")
This message validates as English! 

Received on Wednesday, 31 October 2007 13:42:30 UTC