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

I'm trying to get a handle on proposal 3, more specifically this idea of implicit & insertion (which I really think is a bad idea, but people seem to feel very strongly about it). Could we formulate clearly when & is inserted and when it's not, in a way that doesn't require lookahead to specify what is a valid rule? For instance:

* `.foo { .bar { … }}` — seemingly this should be interpreted as `& .bar` (again, I think we should not do this; the logical thing is to interpret it as `&.bar`, but I'll leave it for now).
* `.foo { .bar & { … }}` — this should _not_ be interpreted as `& .bar &`, because there's already a & in there (it's nest-containing)?
* `.foo { > .bar & { … }}` — however, this should be interpreted as `& > .bar &`, because it starts with a combinator? Or should this be a parse error? (Why?)
* `.foo { :hover { … }}` — This should be `& :hover` and _not_ `&:hover`? But I've seen examples where people seem to assume it's the latter.
* `.foo { :is(&) { … }}` — Should this be interpreted as `&:is(&)` or just `:is(&)`? I would assume the latter, since it's nest-containing, but you may have to dig pretty deep to find the &.
* `.foo { :is(.bar, !#&/) { … }}` — Is this nest-containing (which then decides whether there should be a `& ` in front? There's an & in there, but it's dropped in forgiving selector parsing.

And finally:

* `.foo { .bar { … }}` — how do we serialize this?
* `.foo { & .bar { … }}` — how do we serialize this?
* `.foo { > .bar { … }}` — how do we serialize this?
* `.foo { & > .bar { … }}` — how do we serialize this?

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


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

Received on Thursday, 27 October 2022 10:16:09 UTC