Re: Suggestion: Inheritance

I believe that if there's a will, there will also be a way.

Circular references can easily avoided by applying a limitation used within 
any other W3C standard: Don't forward-reference!

This will have two effects:

* A CSS file may be parsed as usual using a single-pass run.

* Circular references can not occur.


It's a simple kind of macro expansion: When parsing a back-reference, 
look-up the corresponding value using /computed/ values from the existing 
CSS tree.

There is no recursion involved. When a back-reference is being read, its 
value is immediately computed by the application and only this computed 
values can be back-referenced later, not the original back-reference link.

RFC:
   Option 1) Back-references are not stored as back-references but as 
computed values.
             Scripts might access the original back-reference value, though.

   Option 2) Back-references are stored as back-references and the computed 
value becomes
             updated whenever a script changes the referenced value.


It's so simple and easy to implement...


Pre-processing tools are not an appropriate solution for a comprehensive 
standard. It's like using a C++ Preprocessor on a C compiler to get C++ 
functionality.

Moreover, it would be a hack to implement certain applications using a 
pre-processor: For example, an application might provide templates (e.g. 
s-shop templates) for clients to adapt the design of their shop edition 
according to corporation needs. In that case you don't want the client to 
dig into each and every CSS detail. An appropriate solution would be to have 
him set some basic CSS styles like body fore and background color and have 
detail CSS styles adapt to these settings immediately without any 
re-compilation.

RFC
Axel Dahmen



>From: Mikko Rantalainen <mikko.rantalainen@peda.net>
>To: Hans Meiser <brille1@hotmail.com>
>CC: www-style@w3.org
>Subject: Re: Suggestion: Inheritance
>Date: Wed, 11 May 2005 08:22:08 +0300
>
>
>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...
>
>--
>Mikko
>

Received on Monday, 16 May 2005 19:30:19 UTC