- From: Jukka K. Korpela <jkorpela@cs.tut.fi>
- Date: Tue, 18 Jan 2011 13:09:21 +0200
- To: "Proton Zero" <proton.zero@gmail.com>, <www-validator-css@w3.org>
Proton Zero wrote: > Whenever the CSS validator uses CSS inside <style> tags (as opposed to > giving the validator raw CSS data), if I do not specify > type="text/css" in the <style> tag, I receive an error: "Unrecognized > link element or xml-stylesheet PI." I suppose that you mean that if you use a <style> element without the type attribute, in an HTML document that you submit to the W3C CSS Validator, then that Validator issues the error message instead of processing the stylesheet. The reason is that when processing an HTML document, the W3C CSS Validator performs somewhat Draconian HTML parsing. Formally, it is correct, since that the type attribute is required in a <style> element, according to published HTML specifications, and without it its content is to be assumed to be in an unknown language. On the practical, it would hardly do any harm to imply text/css, as browsers do. There is practicelly no other style sheet language used inside <style> elements, so the type attribute is pure formality. > Granted, XHTML5's specification is not yet complete, There is no XHTML5. You mean the XHTML serialization of HTML5, which is work in progress (optimistically speaking), expected to be completed around year 2020 or so. > but it does say > that if a "type" attribute for the <style> tag is not given, then it > defaults to "text/css", so the two cases should yield an identical > result. The current HTML5 drafts say so, and this will hardly change. But the reason why <style> without the type attribute should be recognized and processed is that it is common to omit that attribute and we can then know with approximately 100.00% certainty that the content is meant to be in (some flavor of) CSS. I'd be grateful if people who work with the W3C CSS Validator could comment on this. If the Validator can be changed in this respect, there goes (probably) the last reason to use the redundant type="text/css" attribute. As an author, just add the attribute. It does no harm either, if you type it correctly. If you mistype it e.g. as type="text/ccs", well, that's an entirely different matter... -- Yucca, http://www.cs.tut.fi/~jkorpela/
Received on Tuesday, 18 January 2011 11:10:25 UTC