Re: [csswg-drafts] [css-nesting] Syntax suggestion (#4748)

With the `{ ... }` syntax (or the more-explicit variation that adheres to existing common CSS code patterns, `@nest { ... }`), the extra level of indentation could end up being a net positive for authors, as it provides a visual differentiation between properties and child selectors.

Granted, that visual differentiation is largely already there even without the extra indent (eg. in SCSS), albeit just on the nested selectors' properties, not on the selectors themselves... 🤷

---

To sum up, it seems like we've got four main patterns, right?

1. `& .child` / `@nest .grandparent &` (the current spec)
2. A `@nest .selector { ... }` prefix for each and every child selector
3. Wrapping children in `{ ... }`.
4. A single `@nest;` delimiter to indicate the start of the child selectors.

It looks like we've had a grand total of 15 people chime in here. Is there a way to present the options to a somewhat wider audience of devs, without opening up another endless debate? A poll, perhaps, just to gauge general opinion among a few hundred or thousand devs instead of just us 15?

---

Finally, I want to triple-check on something. @tabatkins, in an interview with Chris Coyer almost exactly 10 years ago, you had this to say about considering new ideas for CSS:

> Speed and implementability are important, but never top-level concerns. I generally assume that browsers will figure out how to do whatever’s necessary, and scale things down only when they push back. I’ve been surprised many times in the past both by something being easy or fast that I thought for sure would get shot down, and by things being widely panned that I was certain would be easy or popular.

Have the browser developers themselves concluded that the lookahead required to have simple SCSS-style nesting is a no-go—they pushed back on that? Apologies for not knowing if any of y'all are the browser devs of whom I speak. ;)

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


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

Received on Friday, 12 November 2021 12:30:39 UTC