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

On Aug 21, 2012, at 1:59 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Tue, Aug 21, 2012 at 1:37 PM, Brian Kardell <bkardell@gmail.com> wrote:
>> On Tue, Aug 21, 2012 at 4:32 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>>> Correct.  If we applied CAS on attribute changes, we'd have... problems.
>> 
>> Because you could do something like:
>> 
>> .foo[x=123]{ x:  234; }
>> .foo[x=234]{ x:  123; }
>> 
>> ?
> 
> Precisely.  Any way around this problem pulls in a lot more complexity
> that I don't think is worthwhile.

I suspect it's actually pretty simple to fix. Ban attribute selectors, and forbid setting the class or id attributes using this language.


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.

I also think the proposed semi-dynamic behavior of applying only at DOM insertion time but otherwise being static is super confusing.

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.

Regards,
Maciej

Received on Thursday, 23 August 2012 01:33:22 UTC