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

Yes, I think the `!important.!important` is a good argument against a single `!top` layer.

While, when importing, yes, we _can_ import something into another layer, thus placing it in the desired order, this is only possible if we control over how we import things.

A use case with custom user-styles for a website would, indeed, need do `!top.!top`, or maybe even `!top.!top.!top` to put something as “the topmost”, with the option 2 allowing just identifying which layer is the topmost, and then doing `@layer !website-top, !my-overrides;`. With a flat list of these, you'd need to mention only two layer names — the toppest, and yours, but with the option 3 you'd really need to just dig into the `!top.!top.!top` etc.

Thinking a bit about it: I guess, we _already_ can mix and match the layers including the nested ones: https://codepen.io/kizu/pen/OJKOLOV

```css
@layer bottom, top.foo, whatever, top.bar;

@layer top {
  @layer bar {
    .test { background: lightgreen }
  }
  @layer foo {
    .test { background: pink }
  }  
}

@layer bottom {
  .test { background: red }
}
```

Here, `@layer bottom, top.foo, whatever, top.bar;` can be already kinda confusing, but allowed: we're separately defining an order for the regular layers, and for the layers inside the `top` layer.

This is not really different than `@layer bottom, !foo, whatever, !bar;`.

So, I guess, I'm not slightly more convinced with the option 2.

-- 
GitHub Notification of comment by kizu
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6323#issuecomment-2432939492 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:24:38 UTC