Re: [csswg-drafts] [css-nesting] Problem with mixing properties and selectors (#8249)

> I'm strongly against a "mandatory &" - nothing is helped by requiring an & _somewhere_. (That is, `div > &` satisfies this but is still problematic in such a world, while `> div` has no problems but is mysteriously disallowed by such a restriction.) I don't understand where this suggestion is coming from or in what way it would help us.

Ok, let me explain a bit more.

Being able to skip `&` for selectors that don't start with an ident, is a tradeoff: we win portability (better/copy paste between nesting and `@scope`) and efficiency (faster to type and arguably faster to read) but "you just have to start every nested rule with a `&`" has far better learnability. Unlike some of the opponents of Option 3, I don't think the rule is incomprehensible to authors (heck, you may recall that Option 3 was originally called "Lea's proposal" 😁), but "every rule has to start with `&` is certainly **easier**.

Note that `div &` can just be rewritten as `&:is(div *)`, so expressive power is the same for most (all?) cases.

So I'm tending to somewhat agree with @plinss and @astearns here: if we can ship the better syntax once the unbounded lookahead investigations have finished, I'd be fine shipping a more restricted, easier to explain, form now.

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


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

Received on Saturday, 21 January 2023 13:58:09 UTC