Re: Proposal for "Cascading Attribute Sheets" - like CSS, but for attributes!

On Aug 27, 2012, at 2:07 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> 
> 
> 
>> I have mixed feelings about this proposal overall, but I think it's a little weird to use CSS property syntax instead of markup-like attribute syntax to set attributes. I think this makes the syntax confusingly similar to CSS even though proposed behavior is quite different. Something like this might make more sense:
>> 
>> img.placeholder {
>>    src="/images/1x1.gif"
>>    alt=""
>> }
>> 
>> In other words, make attribute setting look like attribute syntax.
> 
> This is similar to the discussions about monocle-mustache in JS.  I
> prefer being able to simple re-use the existing CSS parser, but I'm
> not completely wedded to it.  I'd need some strong opinions from more
> relevant parties to switch over, though.

I doubt we would be able to actually reuse the CSS parser, at least at the code level, at least for WebKit. To give some examples of issues that arise:

- The CSS parser has specific knowledge of all the CSS properties we recognize and their value syntax. 
- It has no provision for catchall recognition of all other property names with a quoted string value.
- There are some CSS properties that have the same name as meaningful HTML attributes.

> 
>> And finally, I'm skeptical whether the convenience here is worth adding a whole new language to the Web Platform technology stack. It is literally just convenience / syntactic sugar. I'm not sure that rises to the high bar needed to add an additional language to the Web Platform.
> 
> Yeah, this is the major hurdle for this.  My hope is that, by reusing
> the CSS parser and restricting all the expensive parts of CSS
> (dynamicness, remembering where a value came from, etc.), I can pull
> the bar down low enough for this to make it.

I think your assumption is that it's possible to reuse the CSS parser is incorrect, at least for strong values of "reuse".

Regards,
Maciej

Received on Tuesday, 28 August 2012 19:56:45 UTC