Re: @else in Media Queries
Mark Brown <[email protected]> Thu, 23 Jun 2016 12:54:59 +1000
| Newsgroups | gmane.comp.web.css.general |
|---|---|
| Message-ID | <CAM4AczDrLLWa8BioAAHyL4ugMg+V2WoAzf3U3P7YVJ9kHh5AzA@mail.gmail.com> |
On Tue, Jun 14, 2016 at 5:13 AM, Tab Atkins Jr. <[email protected]> wrote: > On Sat, Jun 11, 2016 at 12:54 AM, Mark Brown <[email protected]> wrote: >> Has anyone considered something like >> >> @switch { >> @case C1 { ... } >> @case C2 { ... } >> @default { ... } /* optional */ >> } >> >> ? > > That's identical to the current proposal, just with an extra level of > nesting. More or less. Put another way, a large part of this discussion is essentially about whether or not it is okay to get rid of one pair of braces. > I don't believe the current proposal is error-prone enough > to justify adding an additional rule. (People don't screw up their > if-else chains regularly in other languages.) That claim's not being made. I can, however, make the following claims: * Software that is able to generically handle group rules will be able to handle this. E.g., existing editors are likely to be able to block-fold the entire semantic structure as well as any individual branch. * Since there's no need to ensure that chains are unambiguously resolved, there's more flexibility in the choice of rules and rule names. For example, the children can all be @when rules as in the current proposal, and @else can instead be written "@when true" if you like. There's no need for the (unusual, I think) use of "else" with a condition... * The human cost is one level of nesting. YMMV! Mark