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

Could add `:cond()` to the table?
For `:apply()` negative would be that it is hard to imagine to "apply a selector" and apply leads to thinking of applying css property lists instead... that can be confusing for new users.

@LeaVerou what's the fuss with `when` and being time-related. Is that so bad?

Again I will cite how guards work in some languages, and IMHO the thing this new selector should do is pretty much close go guards: The function signature (the selector + specificity) does not change, but we add some additional conditions under which it varies/should be executed:
* `when` as a guard in LESS http://lesscss.org/features/#mixin-guards-feature
* `when` as a guard in Elixir https://hexdocs.pm/elixir/master/guards.html#why-guards

There is also when as a conditional clause in SQL (which also leads to case):
https://www.postgresql.org/docs/9.4/static/functions-conditional.html
https://docs.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql

There is also `:case()` and maybe `:switch()` could even be used as you could use the same selectors with different switches (or cases, or conds https://elixir-lang.org/getting-started/case-cond-and-if.html#cond - without adding specificity when doing so to apply some basic styles).

Then CSS is - aside transitions - not about time/timing, but declarative like say SQL. So where is the problem with when exactly sounding "time-based"? I can't follow. `when` is even part of of LESS so people familiar with LESS (or guards in general) will quickly understand `:when()`.

Out of the current table I like `:when()` the most as the concept of guards is very close to what this new selector here should do, imho. After that I do like `:also()` which could be a great name for a guarding statement in other languages as well IMHO: Match me by this function name and signature and *also* make sure these constraints are met.

-- 
GitHub Notification of comment by ionas
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2143#issuecomment-361891459 using your GitHub account

Received on Wednesday, 31 January 2018 10:37:17 UTC