- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Thu, 08 May 2025 20:43:43 +0000
- To: public-css-archive@w3.org
@DarkWiiPlayer Functions and mixins work very differently in this respect. Mixins *must* be defined globally; they're applied at the stylesheet/rules level, before any rule application actually occurs. (Technically they don't need to be "global", they can be lexically constrained in several ways, but it's definitely not cascadeable.) Functions can theoretically be defined "locally" on an element and cascade/inherit like custom properties. But that complicates the model, and is *rarely* necessary; the vast majority of functions would be defined on the root anyway so the whole page has access to them. Complications include things like: 1) there are now two places the function could take variables from (definition element, and calling element), so we need syntax to distinguish one from the other (and maybe allow the callsite to override a variable provided by the definition site); 2) variables already hold the `--foo: ...;` syntax space, so we'd need to carve out something new, and expose this in the element's style somehow; etc. I *do* have some ideas in my back pocket for defining "local" copies of a function that pre-fill some of the arguments and ambient variables that I might explore in v2, but for now we're sticking with the simpler route that solves most problems. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9350#issuecomment-2864269057 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 8 May 2025 20:43:44 UTC