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

I have some mixed feelings here. In one hand, it is one of the feature that we want for like 10 years. In the other hand, I didn't read a comment from a developer that say "I don't car of the name, just ship it, we need it". Perhaps, it's because it's weird to have another operator to do almost the same thing that `:matches`?

A long time ago, for every CSS developers `width` was actually the `content-width`. And we switch, slowy, and now we see `width` as the `box-width`. I see this as a great success, because it's a change of the core of CSS, that didn't introduce too much complexity, we didn't introduce a new property. We handle it like a setting, something you decide at the start of your project. Most developer adopted it, but not everybody use it, it's a choice. We could have introduce a new property like `box-width` but it would have changed our syntax, allow mixed code, and the history of CSS would have been something hard to forget when we code.

I saw an idea of @philipwalton ( to add an attribute on the `link` tag. I think it could be a great solution. 

My proposal is to add a `specificity` attribute, and a value to switch the specificity of `:matches()`, `:not()`, and `:has()` to zero. For example:
<link specificity="no-pseudo-container" rel="stylesheet" hef="path/to/reset.css">

 - No operator added, I think it would be simpler for the beginner (ex: every code example use the same syntax)
 - `:matches()` is still the opposite of `:not()`
 - It's a setting, something we thing about at the start of our project, and we forget
 - it prevents from mixing `:matches()` and `:if()` that would make a project more complex to read
 - It's explicit, it's not a short name that hide something big
 - We allow us to make a mistake. If at a time, we think the specificity should be handled differently (Ex: every pseudo selector should have no weight?) we could add a new property

 - It prevents mixing `:matches()` and `:if()`, so no fine tuning of our selectors
 - It's not the way we dig for the past months

What do you think about it?

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

Received on Friday, 6 July 2018 07:24:57 UTC