Re: Better Variables through Custom Properties

What if you had

#x {
    data-foo: attr(data-foo);
}

and then in script you change the value of the attribute 'data-foo'?


On Tue, Oct 25, 2011 at 1:50 PM, Roland Steiner
<rolandsteiner@google.com> wrote:
> On Tue, Oct 25, 2011 at 10:41, Brian Kardell <bkardell@gmail.com> wrote:
>>
>> I take it from Tab's "similar to the data-* attributes in HTML" that
>> these are not HTML data attributes and would not be exposed in a
>> writable way via DOM/script?
>
> No, but AFAICT there shouldn't be a reason to not make HTML data attributes
> accessible via attr(), i.e.
> [data-foo] {
>   data-foo: attr(data-foo);
> }
> With this you could write to the HTML data attribute and the CSS variable
> (same name not required) should pick it up.
>
> - Roland
>

Received on Tuesday, 25 October 2011 18:07:56 UTC