W3C home > Mailing lists > Public > www-style@w3.org > November 2011

Re: [variables] invalid variables

From: Roland Steiner <rolandsteiner@google.com>
Date: Thu, 3 Nov 2011 14:02:44 -0700
Message-ID: <CACFPSpj=f3TGGwMi2hkW3sTuiv=tfMbqPBq3UbYsEHFib=UeQQ@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style@w3.org
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:46 GMT