w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.47k stars 658 forks source link

[selectors4] Name the “functional pseudo-class like :matches() with 0 specificity” #2143

Closed fantasai closed 5 years ago

fantasai commented 6 years ago

In Issue #1170 we decided to add a functional pseudo-class that is exactly like :matches() but has zero specificity. However, we didn't decide on a name.

Suggestions in that thread included :is(), :when(), :filter(), and :nospecificity(). It was noted that having :filter() as a selector and filter s a property might be confusing, and that :nospecificity() is a pain to type. Additional suggestions, comments, and clarifications welcome.

gibson042 commented 5 years ago

:zero() and :nil() aren't great in many ways, but at least they fulfill the two criteria I mentioned: they're short, and they imply something about what makes them different from :matches()/:not(). Or :is()/:not() if we lived in an ideal world and could rename :matches(). :)

@fantasai We may not live in an ideal world, but I think we do live in one that's close enough to introduce :is() and redefine :matches() as a deprecated alias of it. What do you think?

fantasai commented 5 years ago

@gibson042 Filed https://github.com/w3c/csswg-drafts/issues/3258 on renaming :matches() to :is(). If anyone has an opinion on it, please comment there.

inoas commented 5 years ago

TLDR: Thank you so much

I predict :where() will lead to a new enlighten age of reset/base, classless, css libraries like https://github.com/mblode/marx and similar. In conjunction with the data attribute and other attribute selectors there will be a trove of options now to reset stuff without doing ANY harm.

I love that the WG got through with it eventually and even picked a declarative/functional/semantic name (where over nil). There will be new reset stylesheets that won't interfere with any specificy issues and we will finally have a nice base to cover all different browsers and OS platforms. Obviously properties that affect form widgets (like appearance), outlines, highlights, scrollbars, overscrolling/touch etc. are now things that need to be resolved as quickly as possible so that it becomes easy to reset everything, or - everything but form controls, scrollbars, overscrolling etc.

Thank you so much (:is() will follow as an alias of :matches() and sanity returns)