Re: [csswg-drafts] [css-values] Introduce `self()` function (#9459)

@LeaVerou fwiw I believe this `self()` function seeks to achieve the missing lexical reference needed for mixins as mentioned in https://github.com/w3c/csswg-drafts/issues/9350:
* https://github.com/w3c/csswg-drafts/issues/9350#issuecomment-1769202142
 
 @LeaVerou
 
 ### Must-have, but we could be left out in L1 if really needed
 * Nesting. Without it mixins can only accommodate the simplest of use cases. It can wait for L2, but the syntax must be designed to allow it.
 * Non-conditional @-rules in mixins. Think of fonts, animations, custom properties, font palettes, @scope etc.
* https://github.com/w3c/csswg-drafts/issues/9350#issuecomment-1806225831
 
 @mirisuzanne
 
 > Lea only listed this as a requirement for mixins, so I don't think there's any disagreement here.
 > 
 > > > Non-conditional @-rules in mixins. Think of fonts, animations, custom properties, font palettes, [@scope](https://github.com/scope) etc.
 > > 
 > > 
 > > Only insofar as these rules already work when nested inside of style rules. When they do, they should work in mixins; when they don't, they shouldn't.


That doesn't mean that this proposal is the solution by any means, but I hope that does a better job of explaining the purpose of this proposal than I did previously.

`self()` would expose the values set for other properties on the element, which would be especially valuable in both functions and mixins.

As you mentioned, this could be the same as "<code>var()</code> for any property", in which case, <code>var</code> itself could be redefined to represent "<b><ins>va</ins></b>luable-<b><ins>r</ins></b>eference" (or similar).

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


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

Received on Wednesday, 13 December 2023 21:39:20 UTC