Re: [csswg-drafts] [css-nesting-1] Syntax Invites Errors (#7834)

Yeah I find @FremyCompany's solution both odd for not being nested, and also somewhat elegant in reusing existing syntax. The departure is that `@else` is not related to one thing being _inside_ the other, but is explicitly the opposite. Conceptually, selectors in `@media` are applied when 'inside' a matching media, and so on. Else appends a 'but otherwise' clause, which makes sense as conceptually un-nested. I go back and forth on it - don't hate it, but also likely wouldn't vote for it.

I've been thinking of this from a 'how would I teach this' perspective - and I think it would be easy to teach. But mostly I'm drawn to @LeaVerou's approach, which I would teach as: _always start nested selectors with a symbol_. The problem cases (elements with descendant combinator) aren't really an edge case, but they're generally straight-forward to fix using this rule. `@scope` and `>>` may also reduce the number of those cases.

(Even though `-` is technically a symbol, and part of declarations, it's not a symbol we allow at the start of selectors - so the rule holds for nesting.)

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 14 October 2022 22:20:53 UTC