W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Proposal for adding variable declaration blocks

From: Brad Kemper <brkemper@comcast.net>
Date: Tue, 1 Jul 2008 22:39:48 -0700
Cc: David Hyatt <hyatt@apple.com>, "www-style@w3.org list" <www-style@w3.org>
Message-Id: <2F6547D6-92B8-44BF-86A7-D493527F068C@comcast.net>
To: fantasai <fantasai.lists@inkedblade.net>

On Jul 1, 2008, at 4:07 PM, fantasai wrote:

>> (2) How to use the declaration block:
>> (a) Make up a fake property.
>> h1 {
>>  includes: headers;
>>  font-size: 24px;
>> }
>> (b) Make up a selector "annotation" notation
>> h1 includes headers {
>>  font-size: 24px;
>> }
>> (c) Make up some other kind of syntax
>> h1 {
>>  @includes headers;
>>  font-size: 24px;
>> }
>> I believe (b) is the most elegant notation.  The only disadvantage  
>> of (b) is that you would not be able to control the precise  
>> ordering (i.e., the properties would just occur at the front always  
>> and could not be precisely placed).
>
> I'd go with (c). (a) is a hack on property syntax.

I'd go with "a". It the simplest and most obvious. It may be a hack  
from the implementor point of view, but from the author point of view,  
it is a familiar way to assign values to properties. There is  
virtually nothing to remember.

Requiring an @ and taking out the colon (as with "c") just makes it  
more complicated and more prone to human error. @-signs do not belong  
inside rules that have already been assigned to selectors.

> And (b) is a hack
> on selector syntax, which is worse because, as Zachary points out,
> it's actually a valid selector. Plus lack of control and a worse
> fallback story... 3 strikes against.

I totally agree. "b" is the least elegant choice.

> I can't think of anything against (c).

I can. For starters, it just looks totally out of place inside the  
rule. Everything else inside rules such as this are assignees on the  
left, and what's being assigned to them on the right, with a colon in  
the middle. I want to be able to assign arrays of property/value  
duples the same way.

> Another possibility is to pick
> a character and use that for all dereferences, similar to the  
> scripting
> language $.
>
> h1 {
>  $headers;
>  background: $backgroundColor;
> }

Meh. I like { background: $backgroundColor; } much more than I like  
{ background: var(backgroundColor); }, but I like { background:  
backgroundColor; } the most. Keep it simple on the authors, even if it  
is a tiny amount of extra work for the implementors. So my version  
would look like this:

h1 {
  use: headers;
  background: backgroundColor;
}
Received on Wednesday, 2 July 2008 05:40:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT