jQuery's combination of element storage + data attributes is rather elegant.

<div id=el data-foo=bar></div>

$('#el').data('foo') //> 'bar';

I've been thinking of implementing the same behavior in 
Element.prototype.retrieve, though get('data-foo') is completely adequate.

These attributes are incredibly useful in client-side templating and 
declarative JavaScript architectures.

As for the tangent on this thread ... If you're concerned about validating 
XHTML, I feel bad for you.


On Jun 28, 2011, at 10:00 AM, Arieh Glazer wrote:

> So what? What does valid mean? Does it break any browser - no. Does it break 
> the semantics of the page? no. Does it decrease your ability to use the 
> validator to identify syntax errors? maybe - but then again - why not simply 
> switch to h5? the browsers couldn't care less about your doctype (as 
> documented at several different resources)
> 
> On Tue, Jun 28, 2011 at 6:40 PM, Steve Onnis <[email protected]> wrote:
> It might work but it is not valid XHTML pre HTML5
> 
>  
> 
> From: Arian Stolwijk [mailto:[email protected]] 
> Sent: Wednesday, 29 June 2011 12:50 AM
> 
> 
> To: [email protected]
> Subject: Re: [Moo] Re: Custom data attribute
> 
>  
> 
> this does even work in IE6.
> 
> On Tue, Jun 28, 2011 at 4:12 PM, Steve Onnis <[email protected]> wrote:
> 
> The comment was in reference to pre HTML5 as it was asked if mootools would 
> support custom attributes for non HTML5 browsers
> 
> 
> -----Original Message-----
> From: Tim Wienk [mailto:[email protected]]
> Sent: Tuesday, 28 June 2011 11:14 PM
> To: [email protected]
> Subject: Re: [Moo] Re: Custom data attribute
> 
> On Tue, Jun 28, 2011 at 15:03, Steve Onnis <[email protected]> wrote:
> > Keep in mind though that doing that sort of thing will invalidate your XHTML
> > unless you generate your own dtd schema and implement that
> 
> http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data-with-the-data-attributes
> 
> --
> Tim Wienk, Software Developer, MooTools Developer
> E. [email protected] | W. http://tim.wienk.name
> 
>  
> 
> 
> 
> 
> -- 
> Arieh Glazer
> אריה גלזר
> 052-5348-561
> http://www.arieh.co.il
> http://www.link-wd.co.il
> 

Reply via email to