Re: [css3-selectors] :contains

Anne van Kesteren (fora) wrote:
> I was wondering a bit about ':contains' [1]. What should be the 
> background-color  in the following cases:
>   <test/>
>   test{                   background:red  }
>   test::before{           content:"PASS"  }
>   test:contains('PASS'){  background:lime }

   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.

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

Lachlan Hunt

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