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

  > 3. No `@nest`, just `CSSStyleDeclaration` in the CSSOM
  >     - Criticism: That means `.cssRules` will also return non-rules? Would `.insertRule()` also accept `CSSStyleDeclaration`?

I am not sure I understood the whole conversation between **mdubet** and **emilio** about this in #8738, but intermixing list of declarations (or `CSSStyleDeclaration`s) and rules in specified order in an internal property (eg. `contents`) seemed like an idiomatic solution.

The first list of declarations in `contents` should be exposed by `style`. `.cssRules` and `.insertRule()` should ignore lists of declarations in `contents`. `.deleteRule()` should eventually move declarations into the first list. It does not seem that painfull.

I did not understood why contents would need to be exposed by the public `.cssRules`. I guess in order to add declarations *after* rules via the CSSOM. Assuming there is a need for this, a new interface like `.insertDeclaration()` and/or `styles` could be defined.

But accepting declarations in `.insertRule()`, ugh. 😬

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


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

Received on Wednesday, 24 April 2024 14:26:49 UTC