W3C home > Mailing lists > Public > www-style@w3.org > October 2008

Re: [Css Variables] Variable Declaration Blocks

From: Andrey Mikhalev <amikhal@abisoft.spb.ru>
Date: Mon, 20 Oct 2008 15:48:00 +0400 (MSD)
To: Andrew Fedoniouk <news@terrainformatica.com>
cc: fantasai <fantasai.lists@inkedblade.net>, Mike Wilson <mikewse@hotmail.com>, www-style@w3.org
Message-ID: <Pine.LNX.4.63.0810201529330.18632@master.abisoft.spb.ru>


On Sat, 18 Oct 2008, Andrew Fedoniouk wrote:

> -- a.css --
> @import url(b.css);
> @import url(c.css);
>
> c.css may arrive first and so to be processed/parsed first. So
> constants in b.css will override the ones in c.css.
>
> Therefore you cannot use constant value in parse time in the
> file where it is declared. So you will get @variables instead of @constants.
>
> It appears as CSS constants in order to be used in parse time
> must obey following rules:
>
> 1) First seen - first used.
>
>   First declaration of the constant establishes its value.
>   Later [re]declarations of the same constant must be ignored.
>
> 2) Scope.
>
>   Scope of constant is the CSS file where it is declared and
>   all its children - CSS files loaded from it by @import
>   statements. New constants declared in child CSS file are not
>   seen in the parent CSS file and so are local to the child
>   CSS file.
>
> All other options lead to @variables as far as I can tell.

if you invent scope, then there is nothing wrong with redeclaration, and 
afaik any _usable_ system allow it, in terms like 'override' and/or 
'conditional set/define'

e.g. in your examle:
b.css:
   define b parametrization constants defaults
   rules
c.css:
   define c parametrization constants defaults
   rules
a.css:
   define parametrization of b
   @import b
   define parametrization of c
   /*???but what should i do if there are conflicting names in b and c?*/
   @import c

>
> Cheers,
>
>
Received on Monday, 20 October 2008 11:48:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:15 GMT