Re: [css-selectors] :contains()

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 UTC