Re: [Css Variables] Variable Declaration Blocks

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 UTC