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

Sorry, I think I have a half-completed response sitting on my other computer. ^_^

From a technical perspective, there's nothing wrong here - behind the covers we'd uniquify the names, and just make sure to keep the original name around for serialization purposes. Not hard.

From a usability perspective tho, I'm not sure about this. The lexical scoping means there's *no way* to set one of these values from script; it can *only* be used/referenced by manipulating rules directly in the OM (which sucks to do). If you *tried* to, it would instead reference the global version of the name (if it existed). We already have this as a minor problem with tree-scoped names in shadow DOM, but it's (a) somewhat rare to set a value in a shadow dom context that you inherited from outside, and (b) usually works anyway, so long as you don't have a name collision. I think this proposal would end up *wanting* to be able to set things more often, but would *never* work.

In particular I think this:

> I'd argue there is literally no case where you want fancy-fade defined inside a block to be available outside said block

is probably wrong? I'd assume you'd want to use it just as often as you'd set any other animation in script, and similar for any other name-definer.

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

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


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

Received on Friday, 12 November 2021 18:48:38 UTC