tabatkins / css-toggle

Proposal for a CSS Toggle spec
Creative Commons Zero v1.0 Universal
28 stars 1 forks source link

bikeshed suggestion — `:checked` → `:toggled` #5

Closed jonathantneal closed 2 years ago

jonathantneal commented 3 years ago

I often think of :checked as exclusively having 2 states (boolean). Since CSS Toggles could be used to give meaning beyond 2 states (like checked, unchecked, & indeterminate), would you consider :toggled (or :toggle) as the pseudo-selector name?

.tristate-check {
  toggle: check 0/2;
}
.tristate-check:toggled(1) {
  /* "checked" styles */
}
.tristate-check:toggled(2) {
  /* "indeterminate" styles */
}
.tristate-check {
  toggle: check 0/2;
}
.tristate-check:toggled(check 1) {
  /* "checked" styles */
}
.tristate-check:toggled(check 2) {
  /* "indeterminate" styles */
}
tabatkins commented 3 years ago

I just updated the spec to use :toggle().

Keeping this open for any other naming suggestions, otherwise I'll stick with :toggle()