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

Re: [Css Variables] Variable Declaration Blocks

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Sat, 18 Oct 2008 12:15:16 -0700
Message-ID: <48FA35C4.6090100@terrainformatica.com>
To: fantasai <fantasai.lists@inkedblade.net>
CC: Mike Wilson <mikewse@hotmail.com>, www-style@w3.org

fantasai wrote:
> 
> Make that
>   http://fantasai.inkedblade.net/style/specs/constants/01
> 
> 

This statement in the document above:

"Named constants are in-scope from the point at which they are declared 
until overridden by a later declaration."

opens the whole can of worms.

Style sheet loading is an asynchronous process.
You cannot guarantee which of two sibling style sheets will be parsed 
first.

Consider this:

-- 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.

Cheers,

-- 
Andrew Fedoniouk.

http://terrainformatica.com
Received on Saturday, 18 October 2008 19:16:00 GMT

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