W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2012

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

From: Dimitri Glazkov <dglazkov@google.com>
Date: Tue, 21 Aug 2012 17:48:51 -0700
Message-ID: <CADh5Ky0DAC3ptO5Oi5CGNY7=4AhWysrV3nLGGFxyoTz+vTEu_g@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Glenn Maynard <glenn@zewt.org>, Brian Kardell <bkardell@gmail.com>, public-webapps <public-webapps@w3.org>, Ojan Vafai <ojan@chromium.org>
Can we extend this to custom DOM element registration somehow?

ul.news>li {
     identity: x-news-item;
}

or maybe even:

ul.news>li {
    identity: url(//example.com/test/news.html#news-item);
}

:DG<

On Tue, Aug 21, 2012 at 4:13 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> On Tue, Aug 21, 2012 at 4:07 PM, Glenn Maynard <glenn@zewt.org> wrote:
>> FWIW, while I don't find the idea of attaching event listeners this way too
>> interesting (maybe I could be convinced, but event capturing is already
>> convenient for most of these examples), being able to say "#myform input {
>> autocomplete: off; autocorrect: off; autocapitalize: off; }" or "a { rel:
>> noreferrer; }" would be great.
>>
>> Having it not apply changes dynamically seems weird, since it looks and
>> feels like CSS.  It'd mean these two things--which look intuitively the
>> same, and behave the same with CSS--would be very different when parentNode
>> is in the document:
>>
>> var div = createMyDiv();
>> parentNode.appendChild(div); // our attributes are applied
>> div.className = "foo"; // and we override them
>>
>> var div = createMyDiv();
>> div.className = "foo"; // we set an attribute
>> parentNode.appendChild(div); // and it gets overwritten
>>
>> Also, the behavior of the latter is different depending on whether
>> parentNode is within a document or not, so it's now also dependent on
>> whether, for example, "document.documentElement.appendChild(parentNode)"
>> happens before or after.
>
> Actually, the two should be identical, because CAS is applied as a
> mutation observer, rather than synchronously.  As long as those
> statements appear in the same microtask, they'll have the same
> behavior regardless of order (CAS will always get to override them).
>
> ~TJ
>
Received on Wednesday, 22 August 2012 00:49:19 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:54 GMT