Re: [css-values-4] inherit(<integer>)

On 10/07/13 08:34, Lea Verou wrote:
> I would like to propose an inherit(<integer>) function, akin to the 
> inherit keyword, but inheriting from a higher up ancestor than just 
> the parent. inherit(1) would be equivalent to the inherit keyword, 
> inherit(2) would inherit from the grandparent and so on. If the 
> parameter is larger than the current element’s levels of nesting, it 
> could:
>
> a) resolve to `initial` OR
> b) be clamped to the levels of nesting that correspond to targeting 
> :root OR
> c) be invalid
>
> I think (b) is more useful, but not sure about implementability.
>
> 0 would resolve to `initial`. Negative parameters would make it invalid.

As a developer, I think that this could be very useful, but I'm a little 
concerned that it would be tied to the actual document structure: if 
additional ancestor elements are introduced (for whatever reason), the 
CSS needs to be corrected. I'm not sure of the feasibility of this, but 
I'd much rather that this take a simple selector, and the first ancestor 
which matches the selector is used. In other words, rather than "color: 
inherit(1)", you might write "color: inherit(.ancestor)".

Including more complex selectors (that is, ones using combinators or 
pseudo-classes) would be troublesome, I admit -- so perhaps they should 
simply be invalid initially.

-- 
Barry van Oudtshoorn
www.barryvan.com.au

Received on Wednesday, 10 July 2013 01:05:45 UTC