Re: [css3-selectors] :contains

>   Content generated with the ::before and ::after pseudo-elements does 
> not actually modify the content of the element; only the way it is 
> presented, and thus does not affect whether or not another selector 
> matches.  The background colour should be red.

I see. How about:


   test{                  background:red;
                          content:"PASS"  }
   test:contains('PASS'){ background:lime }

Personally, I don't see a difference here and I think that they all 
should have a green background (which stands for PASS, obviously). 
Especially since ':first-letter' _does_ apply to '::before'. That would 
lead to incosinstency between selectors, something you should avoid, imo.

>> Just to be sure, the following won't match, right?
>>   <test>&amp;</test>
>>   test:contains('&amp;'){ background:red  }
>   &amp; is an HTML/XML entity, not a CSS entity, so it would not be 
> converted to an ampersand while parsing the CSS.  Therefore the selector 
> would not match your test element.  I expect that it would, however, 
> match this:
> <test>&amp;amp;</test>

That would be logical if the first has a 'red' background, which it 
should have according to the XML parsing rules. I see authors, and maybe 
implementors make mistakes with this though (Opera did) and therefore it 
might be good to add it to the official test suite.

  Anne van Kesteren

Received on Sunday, 30 May 2004 08:36:29 UTC