W3C home > Mailing lists > Public > www-style@w3.org > July 2013

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

From: Barry van Oudtshoorn <bvanoudtshoorn@gmail.com>
Date: Wed, 10 Jul 2013 09:04:49 +0800
Message-ID: <51DCB331.4040209@gmail.com>
To: www-style@w3.org
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

This archive was generated by hypermail 2.3.1 : Wednesday, 10 July 2013 01:05:46 UTC