Re: [csswg-drafts] [css-cascade] Proposal: `@layer initial` should always be the first layer (#10094)

> I don't think named layers need an "initial" sublayer. By definition, you're in control of the named layer; you can set up your sublayer order immediately. The only possible concern is that someone else is using the same layer name and so you're fighting over the namespace, but that just means you should use a different name.

It can be useful when the top layer is set up by someone else, such as when a stylesheet is imported into a layer. It would be confusing if the behavior of `initial` changes depending on how the CSS is imported.

```css
// In foo.css
@layer A, B;

@layer A {…}
@layer B {…}

@layer initial {
  /* expected to go before A and B, normally */
}
```
```css
@import "foo.css" layer(foo);

/* foo.initial now comes after foo.A and foo.B 🙁 */
```

Of course there is a workaround, so maybe not a big concern.
```css
@layer initial, A, B;
```

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


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

Received on Monday, 18 March 2024 16:16:12 UTC