Re: [csswg-drafts] [css-values-4] inherit() function: like var() for parent value, for any property (#2864)

> Am I the only one who thinks that's not a "hack"

FWIW, I think the "hack" part is not the inheritance, but this in particular:

```css
.foo {
   --width: 20px;
   width: var(--width);
}

/* as opposed to: */

.foo {
   width: 20px
}
```

Having to externalize the value *just* so it can be inherited is the "hack", IMO. @castastrophe's suggestion is a bit more ergonomic/readable in that sense, in that you declare the inheritability rather than having to imperatively create the effect in two separate steps.

> If "deeply" inheriting stuff is the primary motivation for this feature

I wouldn't characterize *my* use-cases with "primary", but I would say "substantial" as opposed to "trivial" or "limited".

I also wouldn't say "deep", per se, as there *is* a practical limit to how far up the tree I might need to go... for my purposes, I'd guess that limit is somewhere around 3 or 4 levels of nesting, not 10 or 100.

That's why `parent(parent(width))` is, while a bit inelegant, somewhat reasonable, because the number of wrappings I might need to do would rarely if ever be >= 4. But such a syntax *would become* completely untenable at 100, 10, or probably even 5. At worst, that ugliness would serve as a strong hint (code smell) of probably needing to restructure things.

That said, the maintainability footgun around such absolute traversal steps still concerns me quite a bit.

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


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

Received on Monday, 12 April 2021 14:56:16 UTC