W3C home > Mailing lists > Public > www-style@w3.org > April 2012

Re: [css-selectors] :contains()

From: Sebastian Zartner <sebastianzartner@gmx.de>
Date: Thu, 19 Apr 2012 07:49:14 +0200
Message-ID: <20120419054914.37070@gmx.net>
To: Boris Zbarsky <bzbarsky@MIT.EDU>, www-style@w3.org
> 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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:52 GMT