- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Fri, 10 Nov 2023 23:49:57 +0000
- To: public-css-archive@w3.org
Okay, I understand what you're aiming for, now. So what you're looking for, in essence, is a way to make a given name only visible to certain styles. Unfortunately, this would indeed be a dramatically new ability for CSS properties to have; currently a property is identified purely by a (string) name. With this it would have to become something more complex: a string + document reference, or maybe a uniquified string (often called "mangled" for similar things in programming languages), something like that. It also applies to a lot more than just custom properties. Anything that defines a custom name in CSS would need a similar ability, to prevent clashes. In general, this will be a pretty complicated thing. I could see a limited form being not too bad: having the ability to wrap a portion of a stylesheet, or an import, in a "uniquify" block, wherein *all* author-defined names and name references are magically transformed into unique values that can't be referred to from outside the block. You'd still need to define how they reflect, but that's possible to do; we could, say, require the use of a random value, and a character that's not a valid ident char, so you'd have to write something like `var(--foo\!1234cafe)` (and predict that "1234cafe" random value) to clash on purpose. But all of this is also doable today, by hand, by just choosing a short, unlikely-to-clash prefix. Or doable by a build tool - it would even be reasonably safe to just run a naive regex over a stylesheet (`/var\(\s*--([\w_-]+)/` and `/--([\w_-]+)\s*:/`) and insert a longer prefix so it doesn't interfere with the authoring experience. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9587#issuecomment-1806571211 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 10 November 2023 23:49:59 UTC