<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Embed your data- in HTML 5</title>
	<atom:link href="http://ajaxian.com/archives/embed-your-data-in-html-5/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/embed-your-data-in-html-5</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: codeofficer</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-273392</link>
		<dc:creator>codeofficer</dc:creator>
		<pubDate>Mon, 11 May 2009 03:21:55 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-273392</guid>
		<description>I know this post is old, but I wanted to mention a Rails plugin I just finished that addresses this issue. I implemented it using the somewhat recent data storage methods of jQuery, Prototype and Mootools.

http://github.com/CodeOfficer/js-data-helper/tree/master</description>
		<content:encoded><![CDATA[<p>I know this post is old, but I wanted to mention a Rails plugin I just finished that addresses this issue. I implemented it using the somewhat recent data storage methods of jQuery, Prototype and Mootools.</p>
<p><a href="http://github.com/CodeOfficer/js-data-helper/tree/master" rel="nofollow">http://github.com/CodeOfficer/js-data-helper/tree/master</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bdillard</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263110</link>
		<dc:creator>bdillard</dc:creator>
		<pubDate>Thu, 24 Apr 2008 18:26:21 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263110</guid>
		<description>@httpwebwitch &amp;&amp; John Hartmann:

Agreed that URL-encoded JSON is the way to go for binding complex data to HTML elements. But why overload the class or id attributes with this data? I think the constant overloading of these attributes for unobtrusive JavaScript is reason for the data- attributes in the HTML 5 spec.

I don&#039;t understand why namespacing is an issue. You could always add arbitrary expando attributes to HTML and the browser would ignore what it didn&#039;t understand, even as your script had access to it. This was the approach we took at Orbitz when I worked there. Check out the &quot;agent&quot; attribute on any number of tags at http://www.ebookers.com. If you&#039;re worried about your HTML validating, you can always create a custom DTD that includes your expando elements.</description>
		<content:encoded><![CDATA[<p>@httpwebwitch &amp;&amp; John Hartmann:</p>
<p>Agreed that URL-encoded JSON is the way to go for binding complex data to HTML elements. But why overload the class or id attributes with this data? I think the constant overloading of these attributes for unobtrusive JavaScript is reason for the data- attributes in the HTML 5 spec.</p>
<p>I don&#8217;t understand why namespacing is an issue. You could always add arbitrary expando attributes to HTML and the browser would ignore what it didn&#8217;t understand, even as your script had access to it. This was the approach we took at Orbitz when I worked there. Check out the &#8220;agent&#8221; attribute on any number of tags at <a href="http://www.ebookers.com" rel="nofollow">http://www.ebookers.com</a>. If you&#8217;re worried about your HTML validating, you can always create a custom DTD that includes your expando elements.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hvendelbo</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263105</link>
		<dc:creator>hvendelbo</dc:creator>
		<pubDate>Thu, 24 Apr 2008 15:08:13 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263105</guid>
		<description>The great thing about this approach is that it is a convention.
1) It will be supported on all current browsers
2) By making it a standard future browsers can be expected to support it
3) It describes something that is already done, and works well.

In principle I think xhtml is the way to go but in reality you have to deal with backwards compatibility. An observation core to the design of http &amp; html is that of inconsistency. The more you rely on strong semantics the less consistency you can accept and the more often you will fail to show a page.
It seems to me that this fits nicely with REST principles.</description>
		<content:encoded><![CDATA[<p>The great thing about this approach is that it is a convention.<br />
1) It will be supported on all current browsers<br />
2) By making it a standard future browsers can be expected to support it<br />
3) It describes something that is already done, and works well.</p>
<p>In principle I think xhtml is the way to go but in reality you have to deal with backwards compatibility. An observation core to the design of http &amp; html is that of inconsistency. The more you rely on strong semantics the less consistency you can accept and the more often you will fail to show a page.<br />
It seems to me that this fits nicely with REST principles.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: trav1m</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263103</link>
		<dc:creator>trav1m</dc:creator>
		<pubDate>Thu, 24 Apr 2008 14:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263103</guid>
		<description>I wonder what was wrong with:
.
div id=&quot;spaceship-92432&quot; class=&quot;spaceship&quot;
  ...
/div
script
  getDocumentById(&quot;spaceship-92432&quot;).weapons = &quot;laser-2&quot;;
  // etc
/script</description>
		<content:encoded><![CDATA[<p>I wonder what was wrong with:<br />
.<br />
div id=&#8221;spaceship-92432&#8243; class=&#8221;spaceship&#8221;<br />
  &#8230;<br />
/div<br />
script<br />
  getDocumentById(&#8220;spaceship-92432&#8243;).weapons = &#8220;laser-2&#8243;;<br />
  // etc<br />
/script</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: trav1m</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263102</link>
		<dc:creator>trav1m</dc:creator>
		<pubDate>Thu, 24 Apr 2008 14:08:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263102</guid>
		<description>Wow. Why bother to write an HTML 5 spec at all? Apparently the only thing a spec does is make people complain about what it prevents them from doing.
.
I wonder what was wrong with:
.

  ...


  getDocumentById(&quot;spaceship-92432&quot;).weapons = &quot;laser-2&quot;;
  // etc
</description>
		<content:encoded><![CDATA[<p>Wow. Why bother to write an HTML 5 spec at all? Apparently the only thing a spec does is make people complain about what it prevents them from doing.<br />
.<br />
I wonder what was wrong with:<br />
.</p>
<p>  &#8230;</p>
<p>  getDocumentById(&#8220;spaceship-92432&#8243;).weapons = &#8220;laser-2&#8243;;<br />
  // etc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: khaitu</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263100</link>
		<dc:creator>khaitu</dc:creator>
		<pubDate>Thu, 24 Apr 2008 13:27:35 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263100</guid>
		<description>Totally agree with docyes - namespacing is the way to go and what&#039;s more, its not *that* complex. Its just a pain with non-standards-compliant browsers (i.e. IE) which don&#039;t support the getElementsByTagNameNS method.</description>
		<content:encoded><![CDATA[<p>Totally agree with docyes &#8211; namespacing is the way to go and what&#8217;s more, its not *that* complex. Its just a pain with non-standards-compliant browsers (i.e. IE) which don&#8217;t support the getElementsByTagNameNS method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Spocke</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263098</link>
		<dc:creator>Spocke</dc:creator>
		<pubDate>Thu, 24 Apr 2008 09:31:33 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263098</guid>
		<description>@Joeri: Yes, it seems to be that way. I guess it was all the less geeky web people not understanding the concept and need for XML as a HTML storage format. It&#039;s a shame it feels like a big step backwards but I guess the majority never took that step anyway so thats the failure of XHTML.</description>
		<content:encoded><![CDATA[<p>@Joeri: Yes, it seems to be that way. I guess it was all the less geeky web people not understanding the concept and need for XML as a HTML storage format. It&#8217;s a shame it feels like a big step backwards but I guess the majority never took that step anyway so thats the failure of XHTML.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joeri</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263096</link>
		<dc:creator>Joeri</dc:creator>
		<pubDate>Thu, 24 Apr 2008 07:23:17 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263096</guid>
		<description>@Spocke
The tag soup web is here to stay. It&#039;s too difficult to get everyone to &quot;play nice&quot; and produce valid XML. I don&#039;t see a validating web happening, pretty much ever.

HTML5 is a sorely needed upgrade to the tag soup web, so I&#039;m glad they&#039;re being practical about the sort of extensions that go into it.</description>
		<content:encoded><![CDATA[<p>@Spocke<br />
The tag soup web is here to stay. It&#8217;s too difficult to get everyone to &#8220;play nice&#8221; and produce valid XML. I don&#8217;t see a validating web happening, pretty much ever.</p>
<p>HTML5 is a sorely needed upgrade to the tag soup web, so I&#8217;m glad they&#8217;re being practical about the sort of extensions that go into it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Spocke</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263088</link>
		<dc:creator>Spocke</dc:creator>
		<pubDate>Wed, 23 Apr 2008 20:40:02 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263088</guid>
		<description>I see more and more the dream of having a strict XML web slipping away. It would have been so beautiful if everything was XHTML and easy to parse. Adding custom attributes this way without using namespaces will make this future switch harder.</description>
		<content:encoded><![CDATA[<p>I see more and more the dream of having a strict XML web slipping away. It would have been so beautiful if everything was XHTML and easy to parse. Adding custom attributes this way without using namespaces will make this future switch harder.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: docyes</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263079</link>
		<dc:creator>docyes</dc:creator>
		<pubDate>Wed, 23 Apr 2008 17:09:35 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263079</guid>
		<description>Just create a custom namespace and bind to those attributes. Not sold on this one.</description>
		<content:encoded><![CDATA[<p>Just create a custom namespace and bind to those attributes. Not sold on this one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Hartmann</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263072</link>
		<dc:creator>Jon Hartmann</dc:creator>
		<pubDate>Wed, 23 Apr 2008 14:31:57 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263072</guid>
		<description>Well, you _could_ add custom attributes all along, but my understanding was that these had to be name-spaced attributes (ie x:newAttribute=&quot;something&quot;), and accessing name-spaced attributes via JS is a bit more of a pain, as I recall. Its why I&#039;ve tried to move away from custom attributes. The data concept is nice, but feels wrong to me, like when designers have 10 &quot;classes&quot; on an element as JS hooks and data.</description>
		<content:encoded><![CDATA[<p>Well, you _could_ add custom attributes all along, but my understanding was that these had to be name-spaced attributes (ie x:newAttribute=&#8221;something&#8221;), and accessing name-spaced attributes via JS is a bit more of a pain, as I recall. Its why I&#8217;ve tried to move away from custom attributes. The data concept is nice, but feels wrong to me, like when designers have 10 &#8220;classes&#8221; on an element as JS hooks and data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: delorie</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263070</link>
		<dc:creator>delorie</dc:creator>
		<pubDate>Wed, 23 Apr 2008 14:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263070</guid>
		<description>You could add attributes to elements in XHTML all along and you didn&#039;t need the precursor &quot;data-&quot; for my attribute names, though I could see how a precursor would be useful and a best practice.</description>
		<content:encoded><![CDATA[<p>You could add attributes to elements in XHTML all along and you didn&#8217;t need the precursor &#8220;data-&#8221; for my attribute names, though I could see how a precursor would be useful and a best practice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: httpwebwitch</title>
		<link>http://ajaxian.com/archives/embed-your-data-in-html-5/comment-page-1#comment-263068</link>
		<dc:creator>httpwebwitch</dc:creator>
		<pubDate>Wed, 23 Apr 2008 14:06:35 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3584#comment-263068</guid>
		<description>Incredibly useful indeed! I rely heavily on some annoying workaround techniques to attach behavioural metadata to elements. Nice to know that in HTML5 we&#039;ll have the tools we need to do it with real HTML attributes.

If you&#039;re stuck looking for a way to embed config data into an element, try turning your data into JSON, url-encode it, and put it into the class attribute. Then on page load, scan for elements containing a JSON-esque class, parse the JSON into an object, and assign that to a child object of the element. Thereafter, your unobtrusive scripts can access the data via  $(&#039;element&#039;).dataobj . I&#039;ve built a robust bootstrapped library using this technique, which works on all major browsers as far back as IE6.

Ian Ring</description>
		<content:encoded><![CDATA[<p>Incredibly useful indeed! I rely heavily on some annoying workaround techniques to attach behavioural metadata to elements. Nice to know that in HTML5 we&#8217;ll have the tools we need to do it with real HTML attributes.</p>
<p>If you&#8217;re stuck looking for a way to embed config data into an element, try turning your data into JSON, url-encode it, and put it into the class attribute. Then on page load, scan for elements containing a JSON-esque class, parse the JSON into an object, and assign that to a child object of the element. Thereafter, your unobtrusive scripts can access the data via  $(&#8216;element&#8217;).dataobj . I&#8217;ve built a robust bootstrapped library using this technique, which works on all major browsers as far back as IE6.</p>
<p>Ian Ring</p>
]]></content:encoded>
	</item>
</channel>
</rss>

