Re: [csswg-drafts] [css-env] Adding custom env() variables (#2627)

I'm not 100% convinced that global variables are a problem here; JavaScript's global variables are a problem because they can clash with built-ins and other namespaces, whereas global environments in CSS would just be local to the styles, and nothing else. CSS has its own rules for handling conflicts, and I don't see a meaningful distinction between global environments and variables defined on `:root` besides the fact that the latter can be overridden by selectors. Defining something in two rules will still overwrite it, similar to how global variables work.

Like, I could see an argument in favour of allowing `@media` nesting, then allowing `var` inside nested `@media` queries to specifically refer to the variables for that element. But again, this affects specificity, and I think that adding environments would make sense for this purpose instead.

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


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

Received on Thursday, 16 March 2023 16:38:16 UTC