Re: [csswg-drafts] [css-cascade-5] Allow authors to explicitly place unlayered styles in the cascade layer order (#6323)

In the call I brought up some potential confusion caused by being able to interleave top and bottom layers, and the UA having to resort them, like `@layer foo !bar baz;` actually being equivalent to `@layer foo baz !bar;`. Bramus had a suggestion about requiring top and bottom layers be specified in different rules, but that doesn't generalize well to nested layers.

But thinking about it more, this isn't a new problem. It's *already* the case that the list gets resorted in some cases: if you write `@layer foo.one bar foo.two;`, that's actually equivalent to `@layer foo.one foo.two bar;`, because sublayers are *always* grouped by their parent layers.

Further, *in practice* the only difference between Option 2 and 3 is the length of the "this is a top layer" sigil. There's actually nothing distinguishing `foo.!one` and `foo.!top.one` except that in the first the special "this is a top layer" sigil is spelled `!`, while in the second it's spelled `!top.`. The extra characters don't meaningfully help distinguish it, so we can just remove them.

(And yes, the "infinitely nested !top layers" thing is an issue; I don't think we want it, so we'd have to syntactically disallow putting rules directly in a top layer; in other words, `foo.!top` would be an invalid layer name at the syntax level. But at that point, the `!top.` characters are *even moreso* just a five-character sigil for "this is a top layer", since the top layers don't exist on their own in a meaningful sense.)

-----------

So yeah, never mind, I'm all for Option 2 now. I just suggest spelling it somewhat more obviously, like with `#`, which is both "weightier" as a glyph and already indicates important things in a selector.

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


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

Received on Wednesday, 23 October 2024 17:32:49 UTC