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

Right, so we're judging the balance of one authoring cost (having to bear the weight of knowing this rule exists, if you're the sort of person who reads lists of at-rules) vs another authoring cost (having to deal with more complicated/magical behavior for several OM methods), plus the impl/spec cost of that magic. (And the *future* spec cost of having to engineer around this magic; as I said above, I *think* this would block us changing to an ObservableArray for `.cssRules`, or at least make such a switch way more complicated and fragile.) 

I think "knowing a do-nothing rule exists" is a lot less pain than "dealing with weird behavior when doing rule-tree manipulation".

(I speak from experience here; I reimplemented most of *the DOM* for myself in Python, even with all its warts, because the XML library I'm using in Bikeshed has a terrible data model and many of its methods have odd magic behavior in the same vein as what's being suggested here. I kept accidentally writing broken code as a direct result of the magic (text would get deleted, or duplicated, or moved in unpredictable ways), so using the DOM and its shitty but *simple and consistent* behavior was *way* better.)

I imagine tutorials would just look something like: 

> `@nest` rules: sometimes implicitly produced by the CSS parser when you're mixing declarations after rules. You can write it yourself, but it doesn't actually do anything. Most of the time CSS doesn't serialize them, either, so you'll only see them if you're using them manually, or manipulating the CSSOM directly.

We can also make the name much less attractive and more obviously internal, if that would help, like `@implicit-nested-properties-group {...}` or something. Slightly on the ridiculous side for length, so it's not something an author would ever reach for when writing code manually, but also a very descriptive name that suggests what it's doing immediately, and is much easier to google for.

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


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

Received on Friday, 24 May 2024 21:49:31 UTC