W3C home > Mailing lists > Public > www-style@w3.org > May 2004

Re: [css3-selectors] :contains

From: Anne van Kesteren (fora) <fora@annevankesteren.nl>
Date: Sun, 30 May 2004 14:35:50 +0200
Message-ID: <40B9D526.4010902@annevankesteren.nl>
To: Lachlan Hunt <lachlan.hunt@iinet.net.au>
Cc: W3C CSS List <www-style@w3.org>, public-css-testsuite@w3.org

>   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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:30 GMT