Re: Proposal for limited :matches pseudoclass

Tab Atkins Jr. wrote:
> 
> It also makes interaction with the rest of the language complex.

I don't think so.

> For example, pseudo-elements can only occur in the last simple selector of
> a normal rule.  With this, though, pseudo-elements will have to be
> allowed on the !'d selector in the middle of the rule.  (Well, we
> could always say that they're still not allowed, but that's a
> nonsensical restriction from an authoring standpoint.)  If they *are*
> used on the !'d selector, then they have to be disallowed on the last
> one for that rule.  There are further issues with pseudoelements that
> must be resolved as well.

All you have to say is that pseudo-elements are only allowed on the
subject of the selector. Period. Whether that subject is explicitly
noted with ! or whether it's implied by being the last part of a
selector without !, it is not necessary to specify.

> Because it's an orthogonal addition to the language (that is, it's not
> a specialization or modification of existing syntax with extant
> rules), what if it's used somewhere odd like :not(!td)?  We can
> declare those invalid (as they should be), but there are many places
> where we'd have to be specific.  By sticking to the pseudoclass syntax
> we remain in familiar territory, which is a significant benefit.

:not() should be the opposite of :matches() imho. I.e. :matches()
means "matches the selector given as an argument" and :not() means
"does not match the selector given as an argument". This is entirely
consistent with the way :not() is defined today, it is merely an
extension of it. And this makes :matches() align with that definition.

Another use case for :matches() defined as above, and one which I
would expect to see sooner since it's merely syntactic sugar, is this:

   tr.special :matches(td, th) { styling for cell }

   .toc:matches(ol, ul) > li > :matches(ol, ul) { font-size: smaller; }

~fantasai

Received on Wednesday, 14 January 2009 19:58:07 UTC