Re: Stylesheet not detected?

Phil Archer wrote:

> The presence of
>
> <link rel="stylesheet" href="http://sstatic.net/so/all.css?v=5767">
>
> on that page and the
>
> 'No style sheet found'
>
> message on the validator result.

That's confusing indeed. There are two fundamental problems here.

First, the "W3C CSS Validator" congratulates for a "valid" style sheet even 
when there is no style sheet, which it then says fairly unnoticeably. This 
was reported (at least) over a year ago:
http://lists.w3.org/Archives/Public/www-validator-css/2008Sep/0006.html
This problem in turn consists of two problems: preceding essential 
information with worse than useless "advice" on polluting a page with "Valid 
CSS" icon and things like that (there's nothing that should be done to that 
except remove it), and saying something about a stylesheet when no 
stylesheet has been processed.

Second, the "W3C CSS Validator" does not retrieve a style sheet when the 
link element referring to it lacks the type attribute. I think this may be a 
new problem, possibly a simple bug. Formally, the type attribute is not 
required, but on the other hand, semantics is nominally left somewhat vague 
when there is no type attribute in a link element with rel="stylesheet". In 
practical terms, of course, there is no point in ignoring such elements - 
browsers don't, and there is no real ambiguity. I might see some point in 
issuing a warning about implying type="text/css" but just ignoring the style 
sheet with no real explanation is just absurd. - If you use, say, 
type="foo/bar", you get the same result: congrulations about "No Error 
Found" and a suggestion to add an icon "To show your readers that you've 
taken the care to create an interoperable Web page". Of course, 
type="foo/bar" should minimally result in a message about unrecognized type 
of style sheet.

> The URI given for the stylesheet is
> valid so I can only guess - and it is a guess - that the absence of
> the type attribute from the link element is causing the validator to
> skip it?

That is correct. It can be verified e.g. in the following two ways:
1) Construct a dummy test page that has the same link element and copy of 
that page with the type="text/css" attribute added. For the former, the 
problem appears; for the latter, it doesn't (one gets a long list of error 
messages and warnings).
2) Just use "W3C CSS Validator" on the original page on Firefox with "Live 
HTTP Headers" extension in use. You'll see that there isn't even any HTTP 
request for the external style sheet.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 

Received on Monday, 14 December 2009 20:04:04 UTC