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

Re: [selectors4] :not(a, b) vs. :not(a):not(b)

From: Simon Sapin <simon.sapin@exyr.org>
Date: Tue, 19 Mar 2013 14:34:39 +0100
Message-ID: <5148696F.3010609@exyr.org>
To: www-style@w3.org
Le 19/03/2013 14:14, Peter Moulder a écrit :
> On Tue, Mar 19, 2013 at 10:27:32AM +0100, Simon Sapin wrote:
>
>> Selectors 4 extends :not() so its argument is a selector list. As I
>> read it, it’s just syntaxic sugar for multiple :not()
>> pseudo-classes. In other words, :not(a, b) is equivalent to
>> :not(a):not(b), just like not(a or b) is not(a) and not(b) in
>> boolean logic. Is this correct?
>
> They differ in specificity: :not(a):not(b) has the sum of the specificities of
> a and b, while that of :not(a, b) is currently defined as the max of the two.

Ah, yes of course. I was thinking of "equivalent" as in what elements 
are matched.


> There's an issue open as to whether the specificity of :matches should change
> from max specificity to something else, though that issue was raised before
> :not was changed to take a selector list, so there isn't yet a corresponding
> proposal as to how or whether the specificity of :not(a, b) might change if
> that proposal for :matches(a, b) were to be adopted.

Yes, there is an inline issue in the spec:
http://dev.w3.org/csswg/selectors4/#specificity

The specificity of :not() and :matches() are, and IMO should remain, 
consistent. I think dbaron’s proposal makes sense, but it requires more 
discussion and unfortunately the group’s focus does not seem to be on 
Selectors at all at the moment.


>> If so, it might be worth pointing out in the spec. Maybe in the
>> html|*:not(:link):not(:visited) example, by saying that it can also
>> be written html|*:not(:link, :visited)
>
> Nevertheless, that might still be a good idea, while noting the difference in
> specificity.

Yes.

-- 
Simon Sapin
Received on Tuesday, 19 March 2013 13:35:03 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:07 GMT