W3C home > Mailing lists > Public > www-style@w3.org > May 2012

Re: [css-variables] Using $foo as the syntax for variables

From: Brian Kardell <bkardell@gmail.com>
Date: Wed, 23 May 2012 20:32:18 -0400
Message-ID: <CADC=+jdqpzsQCP2WyYM4_ZsFDB9R=nEqZMvS3uAnNw60O-SJEA@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style@w3.org, Eric Meyer <eric@oddbird.net>, liam@w3.org
Interesting, I never would have expected that to work, I wonder how many
people would.  Earlier in this thread[1], marat also suggested this:

    /* Using compact $bp as property name instead of long
'background-position' */
    .foo {$bp: center; }

I also didn't expect that to work (don't see how it could if that is the
syntax for assignment), regardless of the syntax, but no one seems to have
addressed it.  I think it is as interesting and maybe as valid as
interpolated strings... no?

[1] http://lists.w3.org/Archives/Public/www-style/2012May/0782.html
On May 23, 2012 8:23 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:

> On Wed, May 23, 2012 at 5:18 PM, Liam R E Quin <liam@w3.org> wrote:
> > On Wed, 2012-05-23 at 12:54 -0700, Tab Atkins Jr. wrote:
> >> [...]
> >
> >> Variables can hold any value,
> >> including values that contain commas.
> >
> > Presumably they can also hold $ signs too.
>
> Kinda.  When I change the spec to explicitly define the value-space,
> unrestricted DELIM tokens won't be allowed.  However, var references
> can be - they're expanded at computed-value time (the only thing
> that's ever "resolved" in a variable before it's used in a property).
>
> > Is the ${name} syntax also allowed? e.g.
> >
> >   content: "hello ${var1}000 and ${var2}nospaceafter";
>
> No, they can only be used as component values right now, so they can't
> be used within strings.  That's an interesting use-case, though.
>
> ~TJ
>
>
Received on Thursday, 24 May 2012 00:32:49 GMT

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