Re: [csswg-drafts] [css-nesting] Lexical scoping for identifiers defined in nested blocks (#6809)

> I don't think it's reasonable to expect that any and all encapsulation happens within Shadow DOM and in the light DOM anything goes and everything should be global. Authors often want scoping as a means to manage their code more easily and create reusable chunks, and asking them to use Shadow DOM every time they want to modularize their CSS code is unrealistic.

Right, that's why I said:

> (Just in general, I think CSS has a very limited capability to scope things in the first place. We don't have the ability to store and pass references around, which makes a lot of this info-hiding impractical in practice, since we can't use ocap mechanisms to expose them where desired. We instead have to work within the limitations of tree-scoping and/or shadows, which is appropriate for some things but not most.)

If shadow-based scoping is too restrictive, then tree scoping, rather than lexical scoping, is the major way I think CSS should pursue this sort of thing. Without the ability to mint and reuse object-capability references, like JS can, lexical scoping ends up being *very* restrictive and not very compatible with the other interfaces into CSS.

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


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

Received on Wednesday, 17 November 2021 20:19:11 UTC