Re: [css-variables][css-cascade] interaction of variables with "initial", "inherit", "default" and the "all" shorthand

On Mon, May 20, 2013 at 1:49 AM, Cameron McCormack <cam@mcc.id.au> wrote:
> Two issues.  First, if you have:
>
>   #a { var-x: 1; }
>   #a > * { var-x: inherit; }
>
> is the computed value of var-x "1" or "inherit"?  From my reading of
> css-cascade, it would be.  There should at least be a note in css-variables
> saying whether it works like this.

Heh, you didn't finish your sentence saying what you thought it would be.  ^_^

I'm not sure what the behavior should be, actually.  I've logged an
issue to track this, and should hopefully fix this by/at the f2f.

I'm leaning toward them not being interpreted, in line with values in
general.  You can already create an invalid value on demand to get the
'inherit' behavior, with something like "var-foo: var(foo);".
However, you can't duplicate the "default" keyword's behavior.

On the other hand, the global keywords are almost a language-level
construct, which just happens to be implemented in the syntax-space of
property values. !important is similar, but is handled at the Syntax
level, so you can't use top-level ! in a custom property value.

(I think in level 2 I'll want some way to type a variable, so you can
hook into more CSS functionality, especially the CSSOM Values API,
rather than it just always being a bare string.)

> Second, if you have:
>
>   #b { var-x: 1; all: initial; }
>
> does 'all' also include custom properties?  If it does, does this
> declaration set var-x to its initial (empty) value, or does it set it to the
> keyword "initial"?

Excellent question!  Logged an issue.

~TJ

Received on Monday, 20 May 2013 22:36:07 UTC