Re: [variables] invalid variables

On Thu, Nov 3, 2011 at 12:22, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Thu, Nov 3, 2011 at 11:58 AM, Roland Steiner
> <rolandsteiner@google.com> wrote:
> > .foo {
> >   color: red; // default value
> >   color: data(override-color); // override only if declared
> > }
> > .bar {
> >   background-color: black;
> >   background-color: data(bg-color);
> >   background-color: linear-gradient(from top left to bottom right,
> > data(from-color) 0%, data(to-color) 100%);
> > }
>
> Your use-case, though, seems to just be asking for the ability to
> provide a default value for a variable if it happens to be
> invalid/undefined.  I think this is a useful thing to want.  We can do
> this by providing a default value as a second argument, analogous to
> the attr() function.


A default value on data() should be fine I guess - it wouldn't quite
address the 2nd of my examples, but I'm not sure that's compelling enough
to warrant added complexity.

For a default value, would chaining be possible? E.g.:

.myvideo::play-button {
  color: data(play-button-color, data(panel-color, black));
}

- Roland

Completely random PS: I guess "data(data(variable-to-choose))" is probably
prohibited as well? (no use case, just curious if that'd be doable).

Received on Thursday, 3 November 2011 21:24:30 UTC