Re: [csswg-drafts] [css-cascade] [css-nesting] Figure out whether we're fine with "shifting up" bare declarations after rules (#8738)

Implementation wise, I think it's a bit more complicated to implement the "last declaration (after rules) wins" if we assume the most obvious way : wrap following declarations in `& { }`

- the serialisation will generally be more verbose
- it means in a future browser some declarations might be wrap in a `& { }`  while they are not currently (because some garbage becomes a valid rule) (I doubt it's an actual issue though?)
- the pseudo-element issue cf snippet will need some additional treatment (until we actually fix the underlying issue and just allow pseudo-element matching for `:is()` and `&` (and it's already a weirdness so maybe we don't care neither).

```html
<style>
.foo::before {
  background-color: blue;
  content: 'nonest';
}
.foo::before {
 & {
  background-color: green;
  content: 'nest';
  }
}
</style>

<div class=foo>Foo</div>
```

There might be a better way to implement all this though.

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


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

Received on Tuesday, 17 October 2023 14:32:47 UTC