Re: [css3-selectors] Grouping

On Jan 9, 2010, at 2:36 AM, François REMY wrote:

> What you're speaking about now *IS NOT* the
> original meaning of :matches selector. It has been
> introduced in this mailing list for another purpose.
> 
> p:matches(a:hover) was introducted to match any
> P tag that contains an element matching "a:hover"
> in it. The :has() syntax has been used too.

I think that the way fantasai described it is compatibly with what what you expect; it is just a matter of a space changing what it filtered by the match.

So, for instance, to "select a P tag that contains an element matching 'a:hover' in it", you would add a space after the p:

p :matches(a:hover)

This means that the pseudo-class is "naked" (not attached to anything that you can see written in the selector chain). When this happens, it is the same as if you attach it to the universal selector:

p *:matches(a:hover)

Since the universal selector is a wild card that can match anything, this is the same as saying "select any P tag that contains **any** element that is an anchor being hovered over", which is equivalent to your way of saying it ("select a P tag that contains an element matching 'a:hover' in it").


> --------------------------------------------------
> From: "fantasai" <fantasai.lists@inkedblade.net>
> Sent: Friday, January 08, 2010 11:32 PM
> To: "Brad Kemper" <brad.kemper@gmail.com>
> Cc: "Tab Atkins Jr." <jackalmage@gmail.com>; "Nikita Popov" <privat@ni-po.com>; "news" <news@terrainformatica.com>; "www-style list" <www-style@w3.org>
> Subject: Re: [css3-selectors] Grouping
> 
>> 
>> Consider that it's the opposite of :not().
>> 
>>  div:not(.header, .footer) /* div that is neither .header nor .footer */
>> 
>>  div:any(.header, .footer) /* div that is either .header or .footer */
>> 
>> As Tab noted, most earlier proposals used :matches()
>> 
>>  div:matches(.header, .footer)
> 

Received on Saturday, 9 January 2010 18:54:12 UTC