Re: [css-variables] allowed syntax of variable values (was Re: status ?)

On Fri, May 25, 2012 at 1:51 PM, L. David Baron <dbaron@dbaron.org> wrote:
> On Friday 2012-05-25 12:26 -0700, Tab Atkins Jr. wrote:
>> On Fri, May 25, 2012 at 11:59 AM, L. David Baron <dbaron@dbaron.org> wrote:
>> > On Friday 2012-05-25 11:43 -0700, Tab Atkins Jr. wrote:
>> >> Sorry, I didn't fully apply the proper edits.  Look in the prop table.
>> >
>> > I guess the important part is:
>> >
>> >  [ <number> | <percentage> | <dimension> | <string> | <ident> |
>> >  <url> | <function> | <hash> ]
>> >
>> > I'd note that <dimension>, <ident>, <function>, and <hash> aren't
>> > actually defined anywhere.
>>
>> Yes, I expect to define them in the Syntax spec.  They have the
>> obvious definitions (<dimension>, <ident>, and <hash> are equal to the
>> corresponding tokens, <function> is equal to the function production
>> in Appendix G).
>
> I don't think we should add normative references to the informative
> Appendix G.  I'd also note that this forbids the use of any new
> units in the values of variables.

Hm?  No, the DIMENSION token covers *all* possible units.


>> > And, in particular, <function> being
>> > defined according to the core grammar would mean this isn't a
>> > simplification at all for implementations, but just constrains the
>> > future syntax of property values (e.g., to not use parentheses as
>> > some drafts of the background shorthand did).
>>
>> Improvements welcome.  If you think I should '(' <value> ')' valid, I
>> can do that.
>
> I'd consider it an improvement to change the "Values:" line back to
> matching the part of the prose that says "The valid possible
> values...".

I've gone ahead and done so, but cleaned it up a little with more
explanatory text:

The <dfn id='value-type'><var>&lt;value></var></dfn> type used in the
syntax above is defined as
anything matching the "value" production in <a
href="http://www.w3.org/TR/CSS2/syndata.html#tokenization">CSS 2.1
Chapter 4.1</a> [[!CSS21]].
This puts almost no restrictions on what kinds of values you can store
in variables.
Obviously, any valid property value
or component of a property
is allowed.
Additionally, this allows things that aren't yet valid CSS,
like unknown keywords or functions,
blocks,
at-rules,
and other kinds of custom micro-syntaxes like what's allowed in calc().
There <em>are</em> still rules, however;
for example,
unbalanced parentheses are invalid.

~TJ

Received on Friday, 25 May 2012 22:56:46 UTC