W3C home > Mailing lists > Public > www-style@w3.org > March 2013

[selectors4][naming] Renaming :matches() (was: Proposal: Logical Combinators / Sets)

From: Simon Sapin <simon.sapin@exyr.org>
Date: Wed, 20 Mar 2013 23:28:35 +0100
Message-ID: <514A3813.2090708@exyr.org>
To: www-style@w3.org
Le 15/03/2013 14:57, Brian Kardell a écrit :
> On Mar 15, 2013 9:14 AM, "Lea Verou" <lea@w3.org> wrote:
>> FWIW, I agree that :any() is a much better name than :matches(). I
>> was always baffled by the WG’s decision to name it :matches,
>> despite the existing implementations, straightforwardness and
>> brevity of :any().
> Excellent  :-) I think it makes more sense in historical perspective
>  given the use cases they were hoping to solve and the evolution of
> ideas that were being tossed around.  At this point though, any or
> any-of definitely seems more sensible.

We discussed this on the conf call today. :any() is great when there are 
multiple arguments:

   some > long + combinator ~ chain:any(.foo, .bar)

But one counter-argument that convinced me is that it doesn’t make any 
sense with a single argument. This can be useful when that selector 
contains combinators:

   ol li:matches(aside li)

A good way to think of this is that :matches() does *not* take a 
comma-separated list of arguments, but its single argument is a 
comma-separated list of selectors. The pseudo-class is true for elements 
that *match* the inner selector list. The commas there have the same 
meaning as at the top level.


Simon Sapin
Received on Wednesday, 20 March 2013 22:28:58 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:09 UTC