Re: [css-variables] Remaining Issues

On Mon, Jun 10, 2013 at 6:54 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> There are three remaining issues on the Variables spec.
>
> 1. Animation behavior.  Should custom properties animate/transition
> like normal properties (always being unrecognized, so they flip at 50%
> progress), or not?  François pointed out that allowing them to be
> animated can produce dependency loops in animations, where the
> animation property itself uses a variable which it animates over.  I'm
> thinking we should disallow animation/transition of custom properties
> - they don't transition at all, and they're ignored in @keyframes
> rules.
>
> 2. How should the global keyword initial/inherit/default be treated?
> Are these more of a language-syntax feature, such that they should be
> obeyed when specified in custom properties, or are they more like
> normal values, such that they become the variable's value?  It seems
> like there may be use-cases for either.
>
> 3. How does 'all' interact with custom properties?  Are they all reset
> as well?  If #2 is decided in favor of treating the keywords as normal
> variables values, how does that interact with this?

Based on this thread, I think my conclusions are:

1. Disallow custom properties from being animated at this level.  When
we add type annotations to custom properties, allow them to be
animated at that point.  (We'll have to solve the "var-* in
'animation'" problem eventually, so this is just punting that for
now.)

Reasoning: Since we can't infer anything about the type of custom
properties, we can't transition them smoothly, and I don't think that
animating them with the "flip at 50%" behavior is very useful.  This
also lets us have a solution now, so we have more time to think about
how we want to solve the 'animation' loop issue.

2. Handle the global keywords as normal for properties, rather than
treating them as the variable's value.

Reasoning: The global keywords are practically a syntax feature, not a
real value.  Additionally, they're handled at specified-value time,
while variables have to be replaced at computed-value time so that
inheritance works, which means that using the global keywords as a
variable value, like "var-foo: default; color: var(foo);" wouldn't do
what you want unless we introduce a layering violation.

3. 'all' doesn't affect custom properties.  In level 2, if it seems
useful, we introduce 'var' which takes the same values, and *only*
works on custom properties.

Reasoning: 'all' is meant to be used to reset styling in various ways,
but variables aren't directly about styling.  They can be used for
scripting purposes, and even when they're used in styling-related
properties, just resetting all the *actual* styles doesn't mean you
want to lose the variables - you may use them in the styles you lay
down after the reset.  On the other hand, being able to shut down
variables explicitly does seem like it might be useful.

~TJ

Received on Wednesday, 19 June 2013 20:34:39 UTC