Re: [csswg-drafts] [css-nesting] Another problem with mixing declarations and rules - error recovery (#8349)

[absolutely true](https://github.com/w3c/csswg-drafts/issues/8349#issuecomment-1399920053), at a tokenizer/parser level.

My comments are specifically about CSS author expectations.

The way nested CSS written today doesn't look anything like these artificial examples.
It is more like this :

```css
.component {
  /* few or no declarations, "component" is mostly just a wrapper, "@scope" doesn't exist yet */
  
  .element-a {
    color: blue;

    &:hover {
      color: pink;
    }

    @media screen {
      color: green; 
    }

    /* maybe some more deeply nested elements ... */
  }

  /* more elements ... */

  /* no declarations at all */
}
```

All the important bits are thrown out.
That a single declaration would also be throw out or not is not relevant to CSS authors because of this.

----

No one is using `@layer` like this :

```css
div {background: green}
@layer {}
p {background: red}
```

Much more common to see this :

- import 

```css
@import url('bootstrap.css') layer(bootstrap);

/* overrides on top of bootstrap here */
```

No one expects their overrides on top of bootstrap to result in a working page when the import is ignored.

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


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

Received on Monday, 23 January 2023 07:49:27 UTC