<br><br><div><span class="gmail_quote">On 4/11/07, <b class="gmail_sendername">Kevin Marks</b> <<a href="mailto:kevinmarks@gmail.com">kevinmarks@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 4/11/07, Jon Barnett <<a href="mailto:jonbarnett@gmail.com">jonbarnett@gmail.com</a>> wrote:<br>> > If you want structured data in this attribute, why not just use JSON?<br>><br>> That's an idea that crossed my mind as well. I dismissed it for a few
<br>> reasons:<br>> - authors would have to entitize quotes and ampersands in their attributes,<br>> which they're not used to doing with JSON normally.<br>> - evaluating it would mean:<br>> var obj = eval(
myelement.getAttribute("_myjson");<br><br>How about defining an attribute that is the name of the js variable<br>for use with that element? Then you can define the variable in a<br><script> tag, and use pure JSON cleanly.
</blockquote><div><br>I don't understand what you mean there. It was said that we don't need to add something new to the DOM. If I understand, you're suggesting a single attribute hypothetically called "params" spec'ed to be a JSON format:
<br><div params="{foo: 'bar', bish: "bash"}"></div><br>with the DOM attribute named params that parses that attribute as JSON into an object so that something like this happens in JavaScript:
<br>...<br>mydiv.params.foo == 'bar'; // it is!<br><br>While that would be nice, it's not something browsers currently do, and the goal is to spec something that today's browsers already handle and HTML5 validators will be happy with. Granted, you can use eval() in Javascript to get what you want in todays browsers, but is it best to actually spec it that way?
<br></div></div>