[whatwg] Attribute for holding private data for scripting

On Apr 9, 2007, at 10:27 AM, Maciej Stachowiak wrote:

> On Apr 8, 2007, at 11:12 AM, Henri Sivonen wrote:
>
>> At http://www.quirksmode.org/blog/archives/2007/04/html_5.html PPK  
>> suggests having an attribute for storing private data for scripts.
>>
>> Currently, one can invent an attribute and it will work for  
>> scripts. However, it will look ugly for conformance checking.  
>> Since this is essentially a conformance definition issue as  
>> browsers would not be required to implement anything new (assuming  
>> a new reflecting attribute on HTMLElement is deemed unnecessary),  
>> adding an attribute for script-private data would be rather easy.
>>
>> I think it would be worthwhile to add an attribute for script- 
>> private data to common attributes, so that scripters who need one  
>> and want to be conforming don't need to abuse e.g. title.
>
> The class attribute can already be used for script-private data. I  
> think the time script authors go for made-up attributes is when  
> they need a set of key-value pairs. Class is not so great for that,  
> but I'm not sure any new attribute would be either, unless it  
> provided some sort of built-in key-value parsing.

If you want structured data in this attribute, why not just use JSON?

-ryan

Received on Wednesday, 11 April 2007 00:01:41 UTC