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

@LeaVerou

>I think I might be misunderstanding your proposal because I’m not sure how `self()` would get grandparent values without custom properties? (and if custom properties are fair game, `inherit()` on the parent works fine)
>
>What do you mean by "long prop-drilling-style implementation"?

`self()` wouldn't expose grandparent values, but a grandparent could use `self()` in a custom property which could then be used by its grandchild. Using inherit would require both the grandchild and child to use `inherit()` (afaik) to retrieve the grandparent value.

>It’s not about whether the value is known, if you're specifying the value on an untyped property, it gets passed down as a list of tokens, the same as if you use another known function, e.g.:
> ```css
> .parent { --foo: calc(1em + 10px); }
> .parent .child {  font-size: var(--foo); }
> ```
>
>If `--foo` is untyped here (i.e. not declared via `@property`, it will just pass down `calc(1em + 10px)` as a list of tokens, which will be interpreted on `.child`, and use its own em sizing, even though the function used is typed in itself (if used somewhere else). Tokens only have meaning depending on the place they are used, not independently, and tokens in untyped properties do not have meaning.

Ah that makes sense. I was making the case that `self()` would always be typed naturally, but yes, once we load those values into a `var()` it would be tokenized

>I was talking about the `self()` proposal, my understanding is we're discussing declarative functions in another issue? This is independent of declarative functions, right? 🤔

Yup! Declarative functions were just a strong use case for this feature, though I also see significant value elsewhere

>Same!

🙂

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


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

Received on Friday, 13 October 2023 18:56:53 UTC