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: Roman Dvornov via GitHub <sysbot+gh@w3.org>
Date: Fri, 29 Jun 2018 21:29:15 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-401478877-1530307754-sysbot+gh@w3.org>
One issue is missed in this thread – error handling. [According to spec](https://drafts.csswg.org/css-syntax/#error-handling) declarations and qualified rules (nested rules as well) have different rules for bad content elimination.
For example, the CSS:
```css
.example {
  background: white;
  &:hover {
     background: gray;
     color: green;
  }
  color: red;
}
```
Will turn to
```css
.example {
  background: white;
}
```
for any modern browser. So `color: red` will be vanished as bad content.
However, with nesting rule support things may be changed – `color: red` will be applied, even with an error in selector (that produce a bad qualified rule that will be thrown away).
Hopefully, nobody is used `&` in CSS. So introducing `&` as a starting for a nested qualified rule is quite safe.

> Alternatively, the only ambiguous case is when the selector starts with an element selector, right? If it starts with an id, class, pseudo-class, or pseudo-element, we know immediately.
What if the ampersand was only required in that case?


-- 
GitHub Notification of comment by lahmatiy
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2701#issuecomment-401478877 using your GitHub account
Received on Friday, 29 June 2018 21:29:22 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:32 UTC