Re: handling of HTML Comments in HTML style element

 > hi,

> hope this is the right play to ask, well for the question:


should read place of course...

> How should the following excerpt from a simple HTML page be working:
> 
>       <style type="text/css">
>               body { color: red }
>               <!-- comment -->
>               body { color: blue }
>               body { color: pink }
>               <!-- comment -->
>               body { color: green }
>           </style>
> 
> (see http://cthedot.de/xbrowsertest/css.html for the complete page)
> 
> At least one browser (Firefox) does seem to interpret the spec
> differently than most other browsers (at least IE, Opera, have not
> testet Safari).
> 
> It seems Firefox invalidates the first CSS statement following a HTML
> comment so the resulting text is pinc which is defined in the 2nd
> following statement.
> 
> As far as I understand the spec <!-- and --> in CSS Stylesheets should
> be ignored so it would lead to the following sheet:
> 
>               body { color: red }
>               comment
>               body { color: blue }
>               body { color: pink }
>               comment
>               body { color: green }
> 
> which definitely has errors in it. 


Not actually errors but not what the stylesheet author probably had in 
mind. Would end in errors if the comment would be somethink like
	
	<!-- a comment which leads to an invalid sheet $ -->

Anyway, the question remains the same.


> But how should the following
> statement be handled now? Ignored as Firefox does it or acknowledged as
> others do it?

Sorry for the original posting being such a mess...

Thanks
Chris

Received on Saturday, 1 September 2007 19:59:59 UTC