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

Re: [css-selectors] :contains()

From: Allan Sandfeld Jensen <kde@carewolf.com>
Date: Fri, 20 Apr 2012 14:25:40 +0200
To: "Sebastian Zartner" <sebastianzartner@gmx.de>
Cc: www-style@w3.org
Message-Id: <201204201425.40455.kde@carewolf.com>
On Friday 20 April 2012, Sebastian Zartner wrote:
> > > I assume you mean the 'textContent' property.
> > > This would be a speed boost in many cases, though you would also lose
> > > functionality. E.g. imagine something like this:
> > > 
> > > <p>This is an <strong>important</strong> sentence.</p>
> > > 
> > > Then you wouldn't have the possibility to style the paragraph by
> > 
> > searching
> > 
> > > for the word 'important'.
> > 
> > I think that can be solved using already existing features of CSS
> > selector, especially level 4.
> 
> How?
> 
> What if you have this:
>   <p>This is an <strong>important</strong> sentence.</p>
>   <p>This is another important sentence</p>
>   <p>This is a third <strong>very <em>important</em></strong> sentence</p>
> 
> I imagine all three paragraphs to be matched using p:contains("important").
> 
> > p:contains('important'), p! *:contains('imporant')
> 
> What does that exclamation mark mean here?
> 
Ah, okay. The explamation mark is the subject selector see 
http://dev.w3.org/csswg/selectors4/#subject

This is what makes it possible to match elements based on the aspects of an 
elements children, but since it is already a feature of the next selectors 
spec, I just dont think we need to duplicate similar functionality inside the 
:contains selector.

Best regards
`Allan
Received on Friday, 20 April 2012 12:26:16 GMT

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