Re: Suggestion: Inheritance

Mikko Rantalainen wrote:

>
> Hans Meiser wrote:
>
>>     .emphasize
>>     {
>>      background-color: body.color;  -- using the computed colour of 
>> the body element
>>      color: inherited.background-color;  using the computed inherited 
>> background-colour
>>     }
>>
>> The requested feature doesn't necessarily require a parent style 
>> sheet or prior CSS declarations of any kind as it refers to computed 
>> values.
>
>
> It's not that easy. What colors should the following result to?
>
> p { color: span.color; }
> .special+p {color: blue; }
> span { color: p.color; }
>
> In addition to that, which selector syntax do you suggest for 
> selecting which element (or rule?) should the computed value be 
> requested from?
>
> If you allow something like
> p { color: *[has_style(display:table)].background-color; }
> there's no limit for the circular references. And if you only allow ID 
> for the source of the value, I think it's too limited.
>
> I'm afraid that you're going to be told to use style sheet 
> preprosessing tools...
>
...or DOM Level 2 (or greater) style-sheet features...

Such that you calculate the computed style on whichever elements you 
want to, and then you simply apply a script to that computed style, and 
modify as wished.

This will account for what I imagine as Hans's original reason for 
proposing this, which I would assume is simply a fact of life "A user 
may specify any style in his/her user Stylesheet, and colors may clash, 
and Hans wants to ensure that .emphasize actually changes colors, based 
on the background color of the body of the site, which would typically 
have no idea on the actual style chosen for body, since the user can 
change it entirely outside of his own stylesheets.

~Justin Wood (Callek)

Received on Wednesday, 11 May 2005 05:29:31 UTC