W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2018

Re: [csswg-drafts] [css-nesting] request to pick up the css-nesting proposal

From: Jonathan Neal via GitHub <sysbot+gh@w3.org>
Date: Sat, 09 Jun 2018 19:09:30 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-395991788-1528571369-sysbot+gh@w3.org>
@battaglr, you responded similarly to a Twitter thread linking here, where the 2 raised complaints were how nesting can lead to:

1. ambiguous and unsearchable selectors via raw appending (`&-bem-class`); and,
2. unnecessarily and deeply nested selectors (`& foo { & bar { & qux { & etc {} } } }`.

Here is a link to that thread: https://twitter.com/jon_neal/status/1004962076824145921, and please let me know if I am misrepresenting your concerns, Luciano.

I think both are worthy complaints. Thankfully, the spec does not allow arbitrary selector appending like Sass. This is even considered [a mistake in Sass](https://github.com/w3c/csswg-drafts/issues/2701#issuecomment-395572904). This will be a non-issue. 😄🎉

I see the second complaint as a pro _and_ a con. Nesting _would_ make writing CSS selector chains a lot easier, and that _could_ lead to poorly written CSS. However, these selectors would not be technically worse than what one can already do by writing out long, complex CSS selectors. I think Sass has proven these benefits _and_ abuses, which means we can better provide author guidance.

Used wisely or unwisely, nesting would offer authors less selector repetition and more structurally organized rules.

GitHub Notification of comment by jonathantneal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2701#issuecomment-395991788 using your GitHub account
Received on Saturday, 9 June 2018 19:09:32 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 18 February 2020 09:36:24 UTC