Re: [css21] parsing of comment and element nodes inside style declaration

On Thu, 13 Oct 2005, Anne van Kesteren wrote:
> 
> What is the expected output of the following documents:
>  <http://annevankesteren.nl/test/css/syntax/009>
>  <http://annevankesteren.nl/test/css/syntax/010>
>  <http://annevankesteren.nl/test/css/syntax/011>
> 
> (Should the document have a red, green or no background...)
> 
> If possible, could someone point me to where this is defined in CSS 2.1?

This is not a CSS2.1 problem (CSS stylesheets are defined to be text 
streams). It's an HTML problem (given a <style> element, how do you 
extract the text stream to pass to the CSS processor). Therefore the 
official answer is to ask the HTML working group.

However, the HTML working group have historically replied to this kind of 
question with the less-than-useful answer "if it isn't conformant then it 
isn't our problem".

WHATWG's WA1 spec defines this in section 2.4.6 paragraph 8:

# For styling languages that consist of pure text, user agents must use a 
# concatenation of the contents of all the text nodes and CDATA nodes that 
# are direct children of the style  element (ignoring any other nodes such 
# as comments or elements), in tree order. For XML-based styling 
# languages, user agents must use all the children nodes of the style 
# element as the style.
 -- http://whatwg.org/specs/web-apps/current-work/#the-style

...so the answers are lime, lime, red.

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 14 October 2005 00:28:22 UTC