Re: [csswg-drafts] [selectors4] Name the “functional pseudo-class like :matches() with 0 specificity”

I've read the whole thread, and I'm aware of that now it's supposedly only an `:if` vs. `:when` question. But I'd like to get back a little bit (if only to show why `:if` and `:when` are mistaken tracks).

It's notable how far we've got from `:is`. `:is` is by far the most intuitive choice, everybody gets that in their mind in the first (or second) place, and there's a reason for that (no, not the funny acronym, which in my view has zero relevance). A selector, by nature, is a predicate, which says something about the matching element. Linguistically, nouns, adjectives and verbs and negation play well as predicates. Not surprisingly, if we look around among the current pseudo-classes, we find exactly these word classes. Any other word class, which the alternatives belong to, including `:if`, `:when`, `:nospecificity`, `:zero` etc., essentially breaks this logic and so hits a little bit in the gut. Obviously they can been read as parts of a sentence, but the reading logic is custom in that case. `:if` is not really a first-order predicate in itself.

Now came the problem with the imperfect contrast with `:not`. I'm not sure how this can be more important, than the above. `:is` is an exception in the system which has no specificity calculation, and having the most generic name plays well with this fact. Technically this imperfect contrast is not a problem at all. It's actually beneficial, because it makes `:is(:not(` meaningful, and it reads well.

On the other hand, in the future, other strategies might appear for specificity management. To me, for example, using the zero-specificity selector (whatever name it has, and however short it is) extensively, particularly with wrapping the whole selector to keep it on zero, is not a good long-term solution. It's just code repetition. We might have a higher order scope for specificity, maybe something like this:

<link rel="stylesheet" type="text/css" href="framework.css" specificity=1>
<link rel="stylesheet" type="text/css" href="mycustom.css" specificity=x>

which might act as the highest order in the calculation placeholders: x,0,0,0. I know it's out of scope (and maybe it is proposed already?), but my point is that specificity strategies can easily evolve above the selector level, so we shouldn't get lost in the supposed significance of the `:is` vs. `:not` question. IMO, `:is` would nicely fill a gap in the API (linguistically) and the zero-specificity function is just a good motive to get it not just as an alias (to `:matches`). Imperfect contrast with `:not` is not a problem at all. And we can leave `:matches` as it is now.

Sorry for being too long.

GitHub Notification of comment by sarimarton
Please view or discuss this issue at using your GitHub account

Received on Wednesday, 1 August 2018 02:12:15 UTC