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

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.

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.

> 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.

pjrm.

Received on Tuesday, 19 March 2013 13:15:18 UTC