- From: Eric Meyer <eric@oddbird.net>
- Date: Wed, 23 May 2012 12:56:28 -0600
- To: www-style@w3.org
- Message-ID: <C4FE36BF2AFE448EB26D4EC00BD3ED7F@gmail.com>
On Wednesday, May 23, 2012 at 12:26 PM, Tab Atkins Jr. wrote: > On Wed, May 23, 2012 at 11:11 AM, Ojan Vafai <ojan@chromium.org (mailto:ojan@chromium.org)> wrote: > > On Wed, May 23, 2012 at 10:32 AM, Tab Atkins Jr. <jackalmage@gmail.com (mailto:jackalmage@gmail.com)> > > wrote: > > > The only two extensions I know I want right now are (1) the ability to > > > specify a default value to be used when a var is invalid or undefined, > > > and (2) the ability to grab the value of a variable from the parent > > > (the inherited value) rather than from the current element. > > > > > > Under the current syntax, these would look something like this: > > > > > > color: var(bar) // normal > > > color: var(bar, red) // default value > > > color: parent-var(bar) // bar from the parent > > > color: parent-var(bar, red) // bar from the parent, with a default value > > > > > > In the new syntax, it would look something like this: > > > > > > color: $bar //normal > > > color: default-var($bar, red) // default value > > > > > > > > > This could still be var($bar, red) and var($bar) could still work. $bar > > could just be an alais for it. Any subset of these options for dealing with > > default values seem fine to me. > > > > > Hm, good point. No reason to use an extra-long name if a shorter one will do. > This could potentially be extended further with multiple fallbacks (eg font-stacks), or with nesting functions: margin: stack($foo, parent($bar), calc($baz + 3em), 20px); -e > > > > color: parent-var($bar) // bar from the parent > > > color: parent-var($bar, red) // bar from the parent, with a default value > > > > > > > > > The new syntax looks strictly better. It prioritizes making the common case > > more readable (or at least more concise) and easier to use without making > > the less common cases any worse. > > > > > That's my argument, yeah. > > ~TJ
Received on Wednesday, 23 May 2012 18:57:03 UTC