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

Although I am opposed to the proposed change here I think it is also important to challenge the opinions that sparked this.

> selectors within nested context are incompatible with those outside of nested context, and with syntax within @scope, which invites a lot of copy-paste errors when transferring code among these contexts

This is not solved by this syntax change. It can only be resolved by giving `&` meaning everywhere.


> the requirement to include & within all the selectors in a list even beyond syntactic disambiguation (instead of allowing relative selectors) is annoying to type, easy to forget.

The only selectors that can omit `&` are those that use a descendant combinator.

`& .foo` -> `.foo`

But not all these :

- `&.foo`
- `& + .foo`
- `& > .foo`
- `& ~ .foo`

And also not when the selector is the first non-declaration.
The gains are very minimal here.

> the requirement to include & within all the selectors in a list even beyond syntactic disambiguation (instead of allowing relative selectors) makes automated (and manual) conversion of existing code much more difficult (requires selector parsing rather than regex).

This is untrue. Regex will never be sufficient for migrations from Sass to nested CSS because complex selectors work fundamentally different.

This is also a one time event and should not be used to motivate a lasting language design.

> &.foo and & .foo are easily confusable (both for reading and for typing), and so long as the latter is required for nested relative selectors this will be a commonly encountered problem

The same is true for `.foo&` vs. `.foo &`.
How does this proposal help in that case?

------

I am really trying to see the upsides of this proposal and have begon working on some sample code that compares certain aspects. Doing this so that I can get a feel for this version of nesting. https://github.com/romainmenke/nesting-proposal-changes-7834

At the moment however I am really struggling with this.
I don't agree with the stated issues and I don't see them solved by the changes.

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


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

Received on Thursday, 6 October 2022 17:50:18 UTC