[selectors] Specificity of :matches() inside :not()

Hi,

I would like some clarification about the specificity of :matches() inside :not().

The definition of :matches() says: "The specificity of a :matches() pseudo-class, however, is the specificity of the most specific complex selector that matched the given element.”.
The definition of :not() says: "The specificity of a :not() pseudo-class is the specificity of the most specifc complex selector in its selector list.”

When an element is matched, and :matches() is inside a :not(), we could conclude:
-Since none of the nested selector inside :matches() matched the element, the specificity of the whole :matches() is null.
-The specificity of the outside :not() would ignore the content of :matches().

However, I think it would make more sense to take the most specific selector when :matches() is in :not(), that way the following two are strictly equivalent:
 :not(foo, .bar, #baz)
 :not(:matches(foo, .bar, #baz))

In either case, a weird side effect is that:
 :not(:not(:matches(foo, .bar, #baz)))
does not behave like:
 :matches(foo, .bar, #baz)
Fixing that case would require giving :not() a specificity when failing to match, which does not seem too hard either.

Any opinion?

Benjamin 

Received on Friday, 31 October 2014 19:31:31 UTC