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

@mdubet can you elaborate on how your proposal would look like? In general mixing rules and declarations seems probably-fine but, at least implementation wise, it's a bit more complicated because:

 * Some things still need just declarations at the end of the day (like the style attribute, SMIL, mapped attributes).
 * All the relevant code is super-hot, so I'm a bit wary of the performance impact of introducing a lot of branches and complexity there.

Another issue is that a lot of the algorithms in the CSSOM don't work if there are mixed rules. For example, consider:

```css
foo {
  padding-top: 0;
  padding-left: 0;
  & { padding-top: 10px; }
  padding-bottom: 0;
  padding-right: 0;
}
```

If there wasn't a nested rule in the middle, the OM would serialize `padding: 0px;`. (To be clear, it doesn't seem hard to fix, just another thing to think about).

In any case I'm curious about how you're envisioning it, because that doesn't seem super clear. I assume you want something like:

```webidl
interface CSSBlockContent : CSSStyleDeclaration {}
```

Or such, where `CSSStyleRule.prototype.style` would start returning a `CSSBlockContent`? One quirk of such interface is that `CSSStyleDeclaration` is "map-like" right now, and iterable (it yields the longhands that are present), and it's not totally clear to me how you'd expose the mixed rules somewhat sanely...

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


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

Received on Thursday, 29 February 2024 10:30:40 UTC