Live data from Hacker News

WebKit Supports Nested CSS

webkit.org

181–183 of 183 posts

Re: WebKit Supports Nested CSS

#181
post #5

Awesome to finally have nesting. The way I see it, this took 10 years longer than it should have. I feel the only big thing missing from the vanilla stack for me right now is a template element that multiple html files can share. Just like how you make a blog header in Jekyll or Hugo and it adds it on all your blog posts get the header. I haven't found an easy way of doing that if I have a bunch of html pages.

We had it briefly in the form of HTML imports, but the powers that be removed it because it’s not powerful enough for JavaScript/web apps development; totally ignoring the fact that the web isn’t just about apps.

Re: WebKit Supports Nested CSS

#183

Earlier quoted context omitted.

I'm saying the "&" should be required _at the start_. Perhaps controversial, I know. I realize this eliminates use cases like em { color: green; li & { color: red; } } It's okay not to support these use cases. They're confusing because they break encapsulation; the rule that appears to be nested inside (in this case, color: red) is affected by an element on the outside (in this case, ). Compare: li { color: blue; } e…

This functional limitation was eliminated from consideration long ago: it’s very common to want that functionality. There were options considered for still denoting nesting, e.g. start all nested chunks with @nest, but this was decided to be inconveniently verbose. I think & is safe from being inconveniently verbose, but you can’t sanely use that without the functional limitation. On your example: nesting is not abou…

Hmm, thanks for the food for thought. In my use of CSS, I rarely come across situations that would call for this, but I'll pay more note to the possibility they might come up.
Post reply on HN