Re: Better Variables through Custom Properties

On Mon, Oct 24, 2011 at 7:36 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 10/24/11 7:39 PM, Tab Atkins Jr. wrote:
>>
>>   data-main-color: #06c;
>
> So what values does data-main-color take?  Is #aaa a color or an an ID or
> something else for that property?

I can go two ways.

1. "Whatever matches the 'term' production in the CSS2.1 grammar".
This is very loose, but it matches everything we might want to use.

2. Some subset of valid CSS values, like keywords, colors, numbers,
and dimensions.  This is easier to deal with (there's actually a
"grammar" for the properties), but might be too restrictive.

In either case, it can be a list of values, separated by spaces,
commas, and/or slashes.


>> In this simple case, two custom properties are set on the root
>> element.  They inherit down to the h1, where they are referenced with
>> the data() function.
>
> What does "referenced" mean?  Some sort of macro expansion that just
> replaces with literal strings?  Something else?
>
> I do think this could be interesting if we actually define a sane processing
> model for it.

I'm still somewhat handwavy about this, because I'm just not sure how
to talk about it, but "textual substitution, with implied whitespace
around the value" seems like it captures what I want.

Received on Tuesday, 25 October 2011 06:13:01 UTC