Re: [csswg-drafts] Proposal: Custom CSS Functions & Mixins (#9350)

@devingfx As an author, I would *love* something like `@same-as`, but I suspect implementing it would be *very* tricky, even with severe restrictions about the type of selectors that can be used there.

Even beyond implementation, there are several conceptual issues too: 
- Which selectors do you pull in? Do you pull in rules from different origins or different cascade layers? If so, do they maintain these associations?
- What about selectors that mean the same thing but with different syntax? E.g. would `@same-as .foo` pull in `[class~="foo"]`, `:is(.foo)`, `:where(.foo)`, `:not(:not(.foo))`? Or even `[class="foo"], [class^="foo "], [class*=" foo "], [class$=" foo"]`? What about subsets like `[class="foo"]` or `[class^="foo"], [class$="foo"]`? If not, you'd end up with different results than an element with an actual `foo` class, but if you do, I suspect figuring out the bounds of equivalency might be non-tractable.

Lastly, even if `@same-as` *were* possible, it does not cover all use cases with mixins, as it does not support parameterization.

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


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

Received on Tuesday, 27 February 2024 23:30:44 UTC