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

> @tabatkins 
> (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.)

I don't think we can make the `foo.!top` an invalid layer, unless the proposal is to make top-level layers bubble up through regular ones and be _always_ at the top even when they're nested?

That would mean that you couldn't encapsulate some styles by importing them into a layer you control, as the topmost layers will escape it.

And if the `#top` will be local to the imported layer and won't escape, we _need_ an ability to access it through `foo.#top`. And with option 2, the infinitely nested top layers is not an issue, as you don't need to do `!top.!top.!top` when you can do just `@layer !top, !topper;`.

Basically, if we write a stylesheet and put some layers above the unlayered, we are only concerned about the order of styles we control. But our stylesheet could be imported into a layer inside another stylesheet, meaning the top layer will be only local inside the imported styles, and in the same way you could mention regular layers, we'll need to mention the top layers.

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