Re: [css-selectors] :contains()

> On 4/19/12 12:23 AM, Sebastian Zartner wrote:
> > In case of dynamic updates you would just need to check the
> > added/modified parts, which in most cases reduces the number of nodes > > to check dramatically.
> 
> Changing (or appending or removing) text would conceivably change the 
> style of all ancestors of the textnode in question, no?  Plus possibly 
> all their descendants depending on the selector.
If you have a structure and selector like the following, yes:

<div>
  <div>
  </div>
</div>

Changed to:

<div>
  <div>
    <div>
      Some text
    </div>
  </div>
</div>

div:contains("text")

As I said before it's depending on the web developer to create correct selectors. While in some cases people might not recognize the incorrect usage of this selector, they will as soon as they use a style, which results in a visible difference.
Using our example div:contains("text") { color:green; } won't be recognized, while div:contains("text") { transform:rotate(30deg); } surely will.
So people will have to be sensitized for correct usage. In our example they probably want to use a selector like div > div > div:contains("text") instead.
I might add that many people will already be aware of this, since there are libraries like the one of Simon or jQuery, which already implement :contains() and there are already hints about performance.

Sebastian
-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a

Received on Thursday, 19 April 2012 05:50:02 UTC