Re: [csswg-drafts] [css-syntax][css-nesting] Design of `@nest` rule (#10234)

@fantasai 

> @andruud
> 
> > That means it won't round-trip "structurally", like we talked about before. But maybe that's not so bad.
> 
> It would, why wouldn't it?

If you do e.g.:

```
.a {
  --x: 1;
  .b { ... }
  --y: 2;
}
```

If you now `deleteRule` the `.b`, then we presumably have two `CSSNestingDeclarations` that will collapse into one when round-tripped.

> I think whether the first declaration block is represented as a rule is up for discussion too. Perhaps there's less to settle if we don't do that.

I think this makes many of the problems go away, yes, but probably not all ...

> And the reason we made this trade-off is because we are willing to accept a slightly less nice CSSOM (which is already quite terrible with all its string-based APIs and reportedly only used by 1% of web developers) to the benefit of all other web developers.

Is there really no rule-like form `@nest` can take which makes it OK for the other 99% to occasionally encounter it [1]? `@group`? Or even a prelude-less `{}`? Additionally, we can reduce the exposure with Tab's [serialization proposal](https://github.com/w3c/csswg-drafts/issues/10234#issuecomment-2123407797), making the flattened representation the canonical one.

[1] Which can only happen if they write it themselves, or if they're reading the CSS of someone else who did.

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


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

Received on Wednesday, 22 May 2024 07:57:42 UTC