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

Granted, that is a pro. Easy to teach around, but still, on the positives side.

----------

I'm still objecting in general on the question of actual justification, but setting that aside for a moment, here's a much less complex variant that still *mostly* satisfies the request:

1. Keep the current spec as-is. (Initial properties go into .style; later properties wrap themselves in an `@nest`. Group rules just always use `@nest`, unless we do decide we want to give them `.style` as well for initial styles.)
2. When serializing the children of a rule, an `@nest` is serialized as its bare declarations if:
    * It's not adjacent to another `@nest`, and 
    * If the parent rule has `.style`, the `@nest` isn't the first child rule. (If we *don't* add `.style` to `@media`/etc, then a first-child `@nest` should serialize bare, but this *is* a decision we won't be able to go back on.)

    Otherwise, it serializes as normal for an at-rule.

This avoids *all* the complexities mentioned in Elika's proposal - no new parsing method, no magic behavior for that parsing method, no magic behavior for deletes, no magic behavior for setting a property in .style, no future constraints on our ability to evolve `CSSRuleList`. As long as you're not modifying the OM directly, it *always* serializes back out without mentioning `@nest`, so you won't notice the existence of the rule at all under normal circumstances. It just doesn't go to any effort to avoid serializing `@nest` when you *do* use the OM to produce a funky structure.

I would accept this behavior under protest, if the WG ended up agreeing that this is indeed a use-case worth solving. (But I'm strongly objecting to Elika's current proposal.)

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


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

Received on Tuesday, 21 May 2024 20:41:47 UTC