<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>HTML5 Doctor &#187; Remy Sharp</title>
	<atom:link href="http://html5doctor.com/author/remys/feed/" rel="self" type="application/rss+xml" />
	<link>http://html5doctor.com</link>
	<description>helping you implement HTML5 today</description>
	<lastBuildDate>Tue, 27 Jul 2010 14:36:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Introducing Web SQL Databases</title>
		<link>http://html5doctor.com/introducing-web-sql-databases/</link>
		<comments>http://html5doctor.com/introducing-web-sql-databases/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 10:15:39 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
				<category><![CDATA[JavaScript APIs]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=1408</guid>
		<description><![CDATA[The Web SQL database API isn't actually part of the HTML5 specification, but it is part of the suite of specifications that allows us developers to build fully fledged web applications, so it was about time we dug around and checked out the deal.]]></description>
			<content:encoded><![CDATA[<p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
            <a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F">
                <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
            </a>
        </div>The Web SQL database API isn&#8217;t actually part of the HTML5 specification, but it is part of the suite of specifications that allows us developers to build fully fledged web applications, so it&#8217;s about time we dig in and check it out.</p>

<p><span id="more-1408"></span></p>

<h2>What&#8217;s in the box?</h2>

<p>If you haven&#8217;t guessed from the overly verbose specification title, Web SQL Databases is a spec that brings SQL to the client side. If you have a back-end developer&#8217;s background, then you&#8217;ll probably be familiar with SQL and happy as a pig in muck. If not, you might want to learn some SQL before you start hacking around, Google&#8217;s your friend here.</p>

<p>The specification is based around SQLite (3.1.19), but having come from MySQL myself, it&#8217;s all pretty much the same (sorry for the sweeping statement!).</p>

<p>For an example of Web SQL Databases working, have a look at the <a href="http://rem.im/html5-tweet-time-range.html">Twitter HTML5 chatter demo</a> I put together. It uses SQL and the WHERE clause to narrow down the recent chat about HTML5 on Twitter (it will work in Safari, Chrome and Opera 10.50).</p>

<p>There are three core methods in the spec that I&#8217;m going to cover in this article:</p>

<ol>
<li><code>openDatabase</code></li>
<li><code>transaction</code></li>
<li><code>executeSql</code></li>
</ol>

<p>Support is a little patchy at the moment. Only Webkit (Safari, SafariMobile and Chrome) and Opera 10.50 (<abbr title="at time of writing">ATOW</abbr> alpha on Mac) support web databases. Fellow Doctor <a href="http://html5doctor.com/author/brucel/">Bruce Lawson</a> has told me that Firefox are holding off as they feel there&#8217;s a better implementation than SQLite (though I hope it&#8217;s similar, whatever they pick). Either way, I&#8217;d definitely recommend checking out the <a href="http://sqlite.org">SQLite</a> documentation for the functions that are available.</p>

<p>Because of this patchy support and the simple fact that Webkit had implemented the database spec some time ago, the spec on the W3C is now slightly ahead of the implementations in Safari, while Webkit is still catching up. On the other hand, since Opera has only just added support, it&#8217;s closer to the spec (I&#8217;ll mention the differences as we go along).</p>

<p>Nonetheless, it&#8217;s fun to play with, so let&#8217;s get playing!</p>

<h2>Creating and Opening Databases</h2>

<p>If you try to open a database that doesn&#8217;t exist, the API will create it on the fly for you. You also don&#8217;t have to worry about closing databases.</p>

<p>To create and open a database, use the following code:</p>

<pre><code>var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024);</code></pre>

<p>I&#8217;ve passed four arguments to the <code>openDatabase</code> method. These are:</p>

<ol>
<li>Database name</li>
<li>Version number</li>
<li>Text description</li>
<li>Estimated size of database</li>
</ol>

<p>The missing feature of <code>openDatabase</code> (I&#8217;m not sure when it was added) is the fifth argument:</p>

<ol start="5"><li>Creation callback</li></ol>

<p>The creation callback will be called if the database is being created. Without this feature, however, the databases are still being created on the fly and correctly versioned.</p>

<p>The return value from <code>openDatabase</code> contains the transaction methods, so we&#8217;ll need to capture this to be able to perform SQL queries.</p>

<h3>Estimated database size</h3>

<p>From the tests I&#8217;ve run, only Safari prompts the user if you try to create a database over the size of the default database size, 5MB. The prompt is shown the image below, asking whether you want to grant the database permission to scale up to the next size of database &#8212; 5, 10, 50, 100 and 500MB. Opera, on the other hand, builds the database without complaining, which I expect might change later as it&#8217;s still in alpha.</p>

<p><img src="http://html5doctor.com/wp-content/uploads/2010/02/webkit-db-size-prompt-e1266517048880.png" alt="Webkit database size prompt" title="Webkit database size prompt" /></p>

<h3>Versions</h3>

<p>I could be wrong, but everything I&#8217;ve tested so far says that versioning in SQL databases is borked. The problem is this:</p>

<p>If you upgrade your database to version 2.0 (e.g., there are some important schema changes since version 1.0), how do you know which visitors are on version 1.0 and which are on version 2.0?</p>

<p>The version number is a <strong>required</strong> argument to <code>openDatabase</code>, so you must <em>know</em> the version number before you try to open it. Otherwise, an exception is thrown.</p>

<p>Also, <code>changeVersion</code>, the method to change the database version, is not fully supported in Webkit. It works in Chrome and Opera, but not in Safari or Webkit. Regardless, if I can&#8217;t determine which version of database the user is on, then I can&#8217;t upgrade the user.</p>

<p>A possible workaround is to maintain a state database, something like the &#8216;mysql&#8217; database in MySQL. This way, you would only have <strong>one</strong> version of this state database, and within this you would record the current version of any databases that control your application. It&#8217;s a hack, but it works.</p>

<h2>Transactions</h2>

<p>Now that we&#8217;ve opened our database, we can create transactions. Why bother with transactions instead of just running our SQL? Transactions give us the ability to <em>rollback</em>. This means that if a transaction &#8212; which could contain one or more SQL statements &#8212; fails (either the SQL or the code in the transaction), the updates to the database are never committed &#8212; i.e. it&#8217;s as if the transaction <em>never happened</em>.</p>

<p>There are also error and success callbacks on the transaction, so you can manage errors, but it&#8217;s important to understand that transactions have the ability to rollback changes.</p>

<p>The transaction is simply a function that contains <em>some code</em>:</p>

<pre><code>var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024);
db.transaction(function (tx) {
  // here be the transaction
  // do SQL magic here using the tx object
});</code></pre>

<p>I recently uploaded a demo to <a href="http://html5demos.com">html5demos.com</a> that demonstrates a transaction rollback in  action: <a href="http://html5demos.com/database-rollback">Web SQL database rollback demo</a></p>

<p>In the nightly builds of the browsers, we also have <code>db.readTransaction</code>, which allows only read statements to run on the database. I assume there are performance benefits to using a read-only <code>readTransaction</code> instead of a read/write <code>transaction</code>, most probably to do with table locking.</p>

<p>Now that we&#8217;ve got our transaction object (named <code>tx</code> in my example) we&#8217;re ready to run some SQL!</p>

<h2>executeSql</h2>

<p>This is the funnel of love for all your SQL goodness. <code>executeSql</code> is used for both read and write statements, includes SQL injection projection, and provides a callback method to process the results of any queries you may have written.</p>

<p>Once we have a transaction object, we can call <code>executeSql</code>:</p>

<pre><code>var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024);
db.transaction(function (tx) {
  tx.executeSql('CREATE TABLE foo (id unique, text)');
});</code></pre>

<p>This will now create a simple table called &#8220;foo&#8221; in our database called &#8220;mydb&#8221;. Note that if the database already exists the transaction will fail, so any successive SQL wouldn&#8217;t run. So we can either use another transaction, or we can only create the table if it doesn&#8217;t exist, which I&#8217;ll do now so I can insert a new row in the same transaction:</p>

<pre><code>var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024);
db.transaction(function (tx) {
  tx.executeSql('CREATE TABLE IF NOT EXISTS foo (id unique, text)');
  tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "synergies")');
});</code></pre>

<p>Now our table has a single row inside it. What if we want to capture the text from the user or some external source? We&#8217;d want to ensure it can&#8217;t compromise the security of our database (using something nasty like SQL injection). The second argument to <code>executeSql</code> maps field data to the query, like so:</p>

<pre><code>tx.executeSql('INSERT INTO foo (id, text) VALUES (?, ?)', [id, userValue]);</code></pre>

<p><code>id</code> and <code>userValue</code> are external variables, and <code>executeSql</code> maps each item in the array argument to the <abbr title="question mark">&#8220;?&#8221;</abbr>s.</p>

<p>Finally, if we want to select values from the table, we use a callback to capture the results:</p>

<pre><code>tx.executeSql('SELECT * FROM foo', [], function (tx, results) {
  var len = results.rows.length, i;
  for (i = 0; i &lt; len; i++) {
    alert(results.rows.item(i).text);
  }
});</code></pre>

<p>(Notice that in this query, there are no fields being mapped, but in order to use the third argument, I need to pass in an empty array for the second argument.)</p>

<p>The callback receives the transaction object (again) and the results object. The results object contains a <code>rows</code> object, which is array-like but <strong>isn&#8217;t</strong> an array. It has a length, but to get to the individual rows, you need to use <code>results.rows.item(i)</code>, where <code>i</code> is the index of the row. This will return an object representation of the row. For example, if your database has a <code>name</code> and an <code>age</code> field, the row will contain a <code>name</code> and an <code>age</code> property. The value of the <code>age</code> field could be accessed using <code>results.rows.item(i).age</code>.</p>

<p>That&#8217;s all you should need to get started with Web SQL Databases. I&#8217;m certain that mini JavaScript libraries are going to emerge to help support working with databases. If you want to find out more about SQL databases (shameless self promotion begins) I just finished the storage chapter for <a href="http://www.amazon.com/Introduction-Html-5-Bruce-Lawson/dp/0321687299">Introducing HTML5</a>, which I&#8217;m writing with fellow Doc Bruce, so check that bad boy out too!</p>

<h2>Demos</h2>

<ul>
<li><a href="http://html5demos.com/database">HTML5 demo showing simple database usage</a></li>
<li><a href="http://html5demos.com/database-rollback">HTML5 demonstration of a transaction rolling back</a></li>
<li><a href="http://rem.im/html5-tweet-time-range.html">Demo showing time range selection using SQLite</a></li>
</ul>

<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/native-drag-and-drop/" rel="bookmark" class="crp_title">Native Drag and Drop</a></li><li><a href="http://html5doctor.com/native-audio-in-the-browser/" rel="bookmark" class="crp_title">Native Audio in the browser</a></li><li><a href="http://html5doctor.com/html5-custom-data-attributes/" rel="bookmark" class="crp_title">HTML5 Custom Data Attributes (data-*)</a></li><li><a href="http://html5doctor.com/your-questions-5/" rel="bookmark" class="crp_title">Your Questions Answered #5</a></li><li><a href="http://html5doctor.com/your-questions-answered-10/" rel="bookmark" class="crp_title">Your Questions Answered #10</a></li></ul></div>

<p>Share and Save:</p>

<pre><code>&lt;a rel="nofollow"  href="http://twitter.com/home?status=Introducing%20Web%20SQL%20Databases%20-%20http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F" title="Twitter"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;title=Introducing%20Web%20SQL%20Databases&amp;amp;bodytext=The%20Web%20SQL%20database%20API%20isn%27t%20actually%20part%20of%20the%20HTML5%20specification%2C%20but%20it%20is%20part%20of%20the%20suite%20of%20specifications%20that%20allows%20us%20developers%20to%20build%20fully%20fledged%20web%20applications%2C%20so%20it%20was%20about%20time%20we%20dug%20around%20and%20checked%20out%20the%20deal." title="Digg"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;amp;m=submit&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F" title="Sphinn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;title=Introducing%20Web%20SQL%20Databases" title="Reddit"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;title=Introducing%20Web%20SQL%20Databases&amp;amp;notes=The%20Web%20SQL%20database%20API%20isn%27t%20actually%20part%20of%20the%20HTML5%20specification%2C%20but%20it%20is%20part%20of%20the%20suite%20of%20specifications%20that%20allows%20us%20developers%20to%20build%20fully%20fledged%20web%20applications%2C%20so%20it%20was%20about%20time%20we%20dug%20around%20and%20checked%20out%20the%20deal." title="del.icio.us"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;title=Introducing%20Web%20SQL%20Databases" title="StumbleUpon"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F" title="Technorati"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.netvibes.com/share?title=Introducing%20Web%20SQL%20Databases&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F" title="Netvibes"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;t=Introducing%20Web%20SQL%20Databases" title="Facebook"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;title=Introducing%20Web%20SQL%20Databases&amp;amp;annotation=The%20Web%20SQL%20database%20API%20isn%27t%20actually%20part%20of%20the%20HTML5%20specification%2C%20but%20it%20is%20part%20of%20the%20suite%20of%20specifications%20that%20allows%20us%20developers%20to%20build%20fully%20fledged%20web%20applications%2C%20so%20it%20was%20about%20time%20we%20dug%20around%20and%20checked%20out%20the%20deal." title="Google Bookmarks"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.friendfeed.com/share?title=Introducing%20Web%20SQL%20Databases&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F" title="FriendFeed"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;t=Introducing%20Web%20SQL%20Databases" title="HackerNews"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;title=Introducing%20Web%20SQL%20Databases&amp;amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;amp;summary=The%20Web%20SQL%20database%20API%20isn%27t%20actually%20part%20of%20the%20HTML5%20specification%2C%20but%20it%20is%20part%20of%20the%20suite%20of%20specifications%20that%20allows%20us%20developers%20to%20build%20fully%20fledged%20web%20applications%2C%20so%20it%20was%20about%20time%20we%20dug%20around%20and%20checked%20out%20the%20deal." title="LinkedIn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;h=Introducing%20Web%20SQL%20Databases" title="NewsVine"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;amp;u=http%3A%2F%2Fhtml5doctor.com%2Fintroducing-web-sql-databases%2F&amp;amp;t=Introducing%20Web%20SQL%20Databases&amp;amp;s=The%20Web%20SQL%20database%20API%20isn%27t%20actually%20part%20of%20the%20HTML5%20specification%2C%20but%20it%20is%20part%20of%20the%20suite%20of%20specifications%20that%20allows%20us%20developers%20to%20build%20fully%20fledged%20web%20applications%2C%20so%20it%20was%20about%20time%20we%20dug%20around%20and%20checked%20out%20the%20deal." title="Tumblr"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /&gt;&lt;/a&gt;
</code></pre>

<p>&lt;br/>&lt;br/></p>
<p><a href="http://html5doctor.com/introducing-web-sql-databases/" rel="bookmark">Introducing Web SQL Databases</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on February 24, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/introducing-web-sql-databases/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>dd-details wrong again</title>
		<link>http://html5doctor.com/dd-details-wrong-again/</link>
		<comments>http://html5doctor.com/dd-details-wrong-again/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 12:00:57 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
				<category><![CDATA[Elements]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[details]]></category>
		<category><![CDATA[dt]]></category>
		<category><![CDATA[figure]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[ie]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=991</guid>
		<description><![CDATA[
            
                
            
        You may recall that I blogged about [...]]]></description>
			<content:encoded><![CDATA[<p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
            <a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F">
                <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
            </a>
        </div>You may recall that I blogged about <a href="http://html5doctor.com/legend-not-such-a-legend-anymore/">legend not being so legend</a> as the heading element for <code>details</code> or <code>figure</code>. After enough noise was made the spec was changed so that the heading and contents of these elements can now be marked up using the <code>dt/dd</code> combo.</p>

<p>Although not immediately obvious why it&#8217;s the right choice, it appeared to work for our needs&#8230;at first. Of course now, it&#8217;s been discovered that it&#8217;s actually a pretty bad idea.</p>

<p><span id="more-991"></span></p>

<h2>How we got here</h2>

<p>In short, <code>details</code> and <code>figure</code> solve a common design pattern and provide nice new semantic tags to solve that problem.  A <code>figure</code> could be an image you&#8217;re referring to in an article or chapter of a book, and the <code>details</code> element allows the user to interactively show and hide the <em>details</em> of some piece of information.</p>

<p>Both elements can contain a heading element to label up the contents.  For some reason, beyond this author&#8217;s understanding, these two elements, completely different in meaning, have been historically tied to using the same solution solve the problem how to markup the heading.</p>

<p>As I mentioned earlier, originally the proposed solution for the headings was to use the <code>legend</code> element, which <a href="http://html5doctor.com/legend-not-such-a-legend-anymore/">proved to completely break</a> in every browser (in new and interesting ways).</p>

<p>Skip forward to mid-September, and Jeremy Keith <a href="http://lists.w3.org/Archives/Public/public-html/2009Sep/0534.html">proposes that we solve the legend issue</a> with the dt/dd combo, and Ian Hickson <a href="http://lists.w3.org/Archives/Public/public-html/2009Sep/0566.html">says</a>:</p>

<blockquote>
  <p>That&#8217;s not a bad idea actually. Ok, done.</p>
</blockquote>

<p>Before this was proposed there was lots of discussion about why we couldn&#8217;t introduce a new element to solve this problem, and Ian points out already 18 (or 22, I forget!) elements that represent some sort of heading.  This is the argument for not introducing another new heading type element to solve the <code>details</code> and <code>figure</code> problem.</p>

<h2>The problem with dt/dd</h2>

<p>Ironically the problem <em>isn&#8217;t</em> with the <code>dt</code> part of the solution, it&#8217;s actually with the <code>dd</code>.  </p>

<p><a href="http://dean.edwards.name/" title="dean.edwards.name/">Dean Edwards</a> (genius behind some very cool JavaScript and something that will soon blow your minds) has been testing these elements in <em>detail</em> and found a very serious issue with the <code>dd</code> in, guess what, IE6 &#038; 7.  I want to explain and draw attention to what Dean has found.</p>

<p>Styling a <code>dd</code> within <code>details</code> or <code>figure</code> (and probably other elements) bleeds to the next element.</p>

<p>By styling a dd red, and only the dd, here&#8217;s what it <em>should</em> look like (and does in IE8):</p>

<p><img src="http://html5doctor.com/wp-content/uploads/2009/10/dd-ie8.png" alt="dd styled in IE8" /></p>

<p>Where as in IE7 (and IE6), the red style bleeds in to the following <code>p</code> element (note the &#8220;this paragraph shouldn&#8217;t be red&#8221;):</p>

<p>![dd styled in IE7](<img src="http://html5doctor.com/wp-content/uploads/2009/10/dd-ie7.png" alt="dd styled in IE8" /></p>

<p>What&#8217;s more, if you look back at the screen shots you can see the last paragraph says &#8220;Contents of first &lt;dd&gt;&#8221;.  The result of that test is being generated by the following JavaScript:</p>

<pre><code>document.getElementsByTagName('dd')[0].innerHTML</code></pre>

<p>Notice how in IE7, the contents of the first <code>dd</code>&#8217;s <code>innerHTML</code> is <strong>empty</strong>.</p>

<p>The problem here is that:</p>

<ol>
<li>IE7 and below can&#8217;t style a <code>dd</code> properly without it breaking and the style bleeding in to adjacent elements.</li>
<li>JavaScript, randomly, can&#8217;t see the contents of the <code>dd</code>.</li>
</ol>

<h2>Is there hope?</h2>

<p>There is a hack that fixes this issue. It&#8217;s pretty mad, but it does fix the styling issue. However the side effects from this hack are outright unacceptable and are so serious I would argue that the hack solution itself is a bug.</p>

<p>The hack is over at the <a href="http://lists.w3.org/Archives/Public/public-html/2009Sep/0802.html">public-html of W3.org</a>, and involves stuffing an open <code>object</code> tag just before we close the <code>head</code> tag.</p>

<p>This isn&#8217;t a clean solution for including in HTML by hand, authors won&#8217;t remember or might get it wrong, so it needs to be perhaps automated as part of the HTML5 enabling script, right?  It would have to be inserted using <code>document.write()</code> as the last part of the <code>head</code> element.</p>

<p>Dean went on to test this, and <a href="http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-September/023247.html">he found</a>:</p>

<blockquote>
  <p>There is a nasty side effect though. As you mentioned the document.write() should be the last thing in the &lt;head&gt;. If there are any scripts following the document.write() then they are <em>not executed</em>.</p>
</blockquote>

<p>The <em>really</em> freakin&#8217; important bit:</p>

<blockquote>
  <p>If there are any scripts following the document.write() then they are <em>not executed</em></p>
</blockquote>

<p>So, to answer the question: <em>is there hope?</em> No, not for the dd/dt combo.  It can&#8217;t be styled properly and hacks will break JavaScript.</p>

<h2>We want the details</h2>

<p>We, as authors, want to make use of <code>details</code> and <code>figure</code> today. Waiting for IE7 to fall out of circulation before we start using these elements (as it&#8217;s been proposed a number of times on the IRC channel and mailing boards) is outright not going to happen.  IE6 &#038; 7 are going to be around for a good more number of years, certainly IE7 (IE6 has at least another 5 years in the beast).</p>

<p>We <em>are</em> going to start enabling the <code>details</code> interactive UI pattern using JavaScript whilst we wait for vendors bake it in to the browser, so the final proposed markup needs to work in all the browsers, <em>including</em> IE6 and IE7.</p>

<p>What are our current options?</p>

<ol>
<li>Give new meaning to an existing element (as we&#8217;ve already tried to), <code>legend</code>, <code>label</code> and <code>dt/dd</code> have been tried, tested and failed. What else could we use?</li>
<li>Repurpose one of the existing <em>new</em> elements (keeping in mind that the dt/dd was repurposed so it should be a consideration).</li>
<li>Create <em>another</em> heading element to solve this problem.</li>
</ol>

<p>The problem is that the conversation seems to have lost steam (or certain Dean was starting to see the conversation go in circles).  If you want to see these two elements make it the final spec, and correctly, head over to either the <a href="irc://irc.freenode.net/#whatwg">IRC channel</a> or the <a href="http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/">mailing list</a>, and get heard.</p>

<h2>Reference links</h2>

<ul>
<li><a href="http://dean.edwards.name/test/details.html">Dean&#8217;s original details test</a> (my modified tests to fire the innerHTML on load: <a href="http://jsbin.com/inugi/edit#html">details</a>, <a href="http://jsbin.com/uluro/edit#html">figure</a>)</li>
<li>Litmusapp browser screenshots of the results: <a href="http://leftlogic.litmusapp.com/pub/6bee14e">details</a>, <a href="http://leftlogic.litmusapp.com/pub/c7f18b4">figure</a></li>
<li>whatwg mailing list thread: <a href="http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-September/023240.html">September</a>, <a href="http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-October/023277.html">October</a><div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/legend-not-such-a-legend-anymore/" rel="bookmark" class="crp_title">Legend not such a legend anymore</a></li><li><a href="http://html5doctor.com/summary-figcaption-element/" rel="bookmark" class="crp_title">Hello, summary and figcaption elements</a></li><li><a href="http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/" rel="bookmark" class="crp_title">How to get HTML5 working in IE and Firefox 2</a></li><li><a href="http://html5doctor.com/2022-or-when-will-html-5-be-ready/" rel="bookmark" class="crp_title">2022, or when will HTML 5 be ready?</a></li><li><a href="http://html5doctor.com/september-html5-spec-changes/" rel="bookmark" class="crp_title">September HTML5 spec changes</a></li></ul></div></li>
</ul>

<p>Share and Save:</p>

<pre><code>&lt;a rel="nofollow"  href="http://twitter.com/home?status=dd-details%20wrong%20again%20-%20http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F" title="Twitter"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;title=dd-details%20wrong%20again&amp;amp;bodytext=You%20may%20recall%20that%20I%20blogged%20about%20%5Blegend%20not%20being%20so%20legend%5D%28http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F%29%20as%20the%20heading%20element%20for%20details%20or%20figure.%20After%20enough%20noise%20was%20made%20the%20spec%20was%20changed%20so%20that%20the%20heading%20and%20contents" title="Digg"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;amp;m=submit&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F" title="Sphinn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;title=dd-details%20wrong%20again" title="Reddit"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;title=dd-details%20wrong%20again&amp;amp;notes=You%20may%20recall%20that%20I%20blogged%20about%20%5Blegend%20not%20being%20so%20legend%5D%28http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F%29%20as%20the%20heading%20element%20for%20details%20or%20figure.%20After%20enough%20noise%20was%20made%20the%20spec%20was%20changed%20so%20that%20the%20heading%20and%20contents" title="del.icio.us"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;title=dd-details%20wrong%20again" title="StumbleUpon"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F" title="Technorati"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.netvibes.com/share?title=dd-details%20wrong%20again&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F" title="Netvibes"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;t=dd-details%20wrong%20again" title="Facebook"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;title=dd-details%20wrong%20again&amp;amp;annotation=You%20may%20recall%20that%20I%20blogged%20about%20%5Blegend%20not%20being%20so%20legend%5D%28http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F%29%20as%20the%20heading%20element%20for%20details%20or%20figure.%20After%20enough%20noise%20was%20made%20the%20spec%20was%20changed%20so%20that%20the%20heading%20and%20contents" title="Google Bookmarks"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.friendfeed.com/share?title=dd-details%20wrong%20again&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F" title="FriendFeed"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;t=dd-details%20wrong%20again" title="HackerNews"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;title=dd-details%20wrong%20again&amp;amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;amp;summary=You%20may%20recall%20that%20I%20blogged%20about%20%5Blegend%20not%20being%20so%20legend%5D%28http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F%29%20as%20the%20heading%20element%20for%20details%20or%20figure.%20After%20enough%20noise%20was%20made%20the%20spec%20was%20changed%20so%20that%20the%20heading%20and%20contents" title="LinkedIn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;h=dd-details%20wrong%20again" title="NewsVine"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;amp;u=http%3A%2F%2Fhtml5doctor.com%2Fdd-details-wrong-again%2F&amp;amp;t=dd-details%20wrong%20again&amp;amp;s=You%20may%20recall%20that%20I%20blogged%20about%20%5Blegend%20not%20being%20so%20legend%5D%28http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F%29%20as%20the%20heading%20element%20for%20details%20or%20figure.%20After%20enough%20noise%20was%20made%20the%20spec%20was%20changed%20so%20that%20the%20heading%20and%20contents" title="Tumblr"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /&gt;&lt;/a&gt;
</code></pre>

<p>&lt;br/>&lt;br/></p>
<p><a href="http://html5doctor.com/dd-details-wrong-again/" rel="bookmark">dd-details wrong again</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on October 12, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/dd-details-wrong-again/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>September HTML5 spec changes</title>
		<link>http://html5doctor.com/september-html5-spec-changes/</link>
		<comments>http://html5doctor.com/september-html5-spec-changes/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 12:00:20 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
				<category><![CDATA[Specification Changes]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[dialog]]></category>
		<category><![CDATA[dt]]></category>
		<category><![CDATA[figure]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[legend]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=911</guid>
		<description><![CDATA[
            
                
            
        September being one month before the HTML5 [...]]]></description>
			<content:encoded><![CDATA[<p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
            <a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F">
                <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
            </a>
        </div>September being one month before the HTML5 spec goes to last call in October, there&#8217;s been a few significant changes to the HTML5 spec that we wanted to briefly share with our patients.</p>

<p><span id="more-911"></span></p>

<h2>Clarification over <code>section</code> and <code>article</code></h2>

<p>The spec has been clarified to help authors correctly choose between when to use <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/sections.html#the-section-element">section</a> and when to use <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/sections.html#the-article-element">article</a>, and <a href="http://html5doctor.com/the-section-element/">Bruce&#8217;s section post</a> has also been updated.</p>

<h2><code>footer</code> now works like <code>header</code></h2>

<p>This was a big one and causing confusing to people coming to HTML5 for the first time.  Originally you couldn&#8217;t include a <code>nav</code> element inside a footer, or a <code>section</code>. </p>

<p>Now the spec has been <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/sections.html#the-footer-element">changed to match the <code>header</code> element</a>.</p>

<h2><code>details</code> and <code>figure</code> saved</h2>

<p>Instead of using legend, <a href="http://html5doctor.com/legend-not-such-a-legend-anymore/">which didn&#8217;t work</a>, <a href="http://adactio.com">Jeremy</a> suggested (although slightly tongue in cheek) to use <code>dt</code> for the title and <code>dd</code> for the body.  Ian Hickson agreed, and <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#the-figure-element">it&#8217;s in</a></p>

<p>Example:</p>

<pre><code>&lt;figure&gt;
 &lt;dd&gt;&lt;video src=&quot;ex-b.mov&quot;&gt;&lt;/video&gt;
 &lt;dt&gt;Exhibit B. The &lt;cite&gt;Rough Copy&lt;/cite&gt; trailer.
&lt;/figure&gt;</code></pre>

<h2><code>aside</code> has better examples</h2>

<p>The documentation has been updated to specify <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/sections.html#the-aside-element">better examples</a> of how the aside element can be used.</p>

<p>Better examples help us authors understand how it can be used.</p>

<h2>Dropped Elements</h2>

<p>The following elements have been dropped from the HTML5 spec (though <code>bb</code> and <code>datagrid</code> were some time ago, and <code>datagrid</code> has been postponed rather than dropped entirely):</p>

<ul>
<li><a href="http://html5.org/tools/web-apps-tracker?from=3858&#038;to=3859">dialog</a></li>
<li>bb</li>
<li>datagrid</li>
</ul>

<h2>Ch-ch-changes</h2>

<p>We&#8217;ll be posting in more detail about some of these changes, and as further changes come out of the editing process we&#8217;ll no doubt keep you all up to date, either via our <a href="http://twitter.com/html5doctor">Twitter account</a> (which you should follow) or feel free to <a href="http://html5doctor.com/contact/">let us know too</a>!<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/legend-not-such-a-legend-anymore/" rel="bookmark" class="crp_title">Legend not such a legend anymore</a></li><li><a href="http://html5doctor.com/the-section-element/" rel="bookmark" class="crp_title">The section element</a></li><li><a href="http://html5doctor.com/the-figure-figcaption-elements/" rel="bookmark" class="crp_title">The figure &#038; figcaption elements</a></li><li><a href="http://html5doctor.com/small-hr-element/" rel="bookmark" class="crp_title">The small &amp; hr elements</a></li><li><a href="http://html5doctor.com/the-footer-element-update/" rel="bookmark" class="crp_title">The Footer Element Update</a></li></ul></div></p>

<p>Share and Save:</p>

<pre><code>&lt;a rel="nofollow"  href="http://twitter.com/home?status=September%20HTML5%20spec%20changes%20-%20http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F" title="Twitter"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;title=September%20HTML5%20spec%20changes&amp;amp;bodytext=September%20being%20one%20month%20before%20the%20HTML5%20spec%20goes%20to%20last%20call%20in%20October%2C%20there%27s%20been%20a%20few%20significant%20changes%20to%20the%20HTML5%20spec%20that%20we%20wanted%20to%20briefly%20share%20with%20our%20patients.%0D%0A%0D%0A%0D%0A%0D%0A%23%23%20Clarification%20over%20section%20and%20article%0D%0A%0D%0AThe%20spec%20has" title="Digg"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;amp;m=submit&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F" title="Sphinn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;title=September%20HTML5%20spec%20changes" title="Reddit"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;title=September%20HTML5%20spec%20changes&amp;amp;notes=September%20being%20one%20month%20before%20the%20HTML5%20spec%20goes%20to%20last%20call%20in%20October%2C%20there%27s%20been%20a%20few%20significant%20changes%20to%20the%20HTML5%20spec%20that%20we%20wanted%20to%20briefly%20share%20with%20our%20patients.%0D%0A%0D%0A%0D%0A%0D%0A%23%23%20Clarification%20over%20section%20and%20article%0D%0A%0D%0AThe%20spec%20has" title="del.icio.us"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;title=September%20HTML5%20spec%20changes" title="StumbleUpon"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F" title="Technorati"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.netvibes.com/share?title=September%20HTML5%20spec%20changes&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F" title="Netvibes"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;t=September%20HTML5%20spec%20changes" title="Facebook"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;title=September%20HTML5%20spec%20changes&amp;amp;annotation=September%20being%20one%20month%20before%20the%20HTML5%20spec%20goes%20to%20last%20call%20in%20October%2C%20there%27s%20been%20a%20few%20significant%20changes%20to%20the%20HTML5%20spec%20that%20we%20wanted%20to%20briefly%20share%20with%20our%20patients.%0D%0A%0D%0A%0D%0A%0D%0A%23%23%20Clarification%20over%20section%20and%20article%0D%0A%0D%0AThe%20spec%20has" title="Google Bookmarks"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.friendfeed.com/share?title=September%20HTML5%20spec%20changes&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F" title="FriendFeed"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;t=September%20HTML5%20spec%20changes" title="HackerNews"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;title=September%20HTML5%20spec%20changes&amp;amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;amp;summary=September%20being%20one%20month%20before%20the%20HTML5%20spec%20goes%20to%20last%20call%20in%20October%2C%20there%27s%20been%20a%20few%20significant%20changes%20to%20the%20HTML5%20spec%20that%20we%20wanted%20to%20briefly%20share%20with%20our%20patients.%0D%0A%0D%0A%0D%0A%0D%0A%23%23%20Clarification%20over%20section%20and%20article%0D%0A%0D%0AThe%20spec%20has" title="LinkedIn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;h=September%20HTML5%20spec%20changes" title="NewsVine"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;amp;u=http%3A%2F%2Fhtml5doctor.com%2Fseptember-html5-spec-changes%2F&amp;amp;t=September%20HTML5%20spec%20changes&amp;amp;s=September%20being%20one%20month%20before%20the%20HTML5%20spec%20goes%20to%20last%20call%20in%20October%2C%20there%27s%20been%20a%20few%20significant%20changes%20to%20the%20HTML5%20spec%20that%20we%20wanted%20to%20briefly%20share%20with%20our%20patients.%0D%0A%0D%0A%0D%0A%0D%0A%23%23%20Clarification%20over%20section%20and%20article%0D%0A%0D%0AThe%20spec%20has" title="Tumblr"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /&gt;&lt;/a&gt;
</code></pre>

<p>&lt;br/>&lt;br/></p>
<p><a href="http://html5doctor.com/september-html5-spec-changes/" rel="bookmark">September HTML5 spec changes</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on September 17, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/september-html5-spec-changes/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Legend not such a legend anymore</title>
		<link>http://html5doctor.com/legend-not-such-a-legend-anymore/</link>
		<comments>http://html5doctor.com/legend-not-such-a-legend-anymore/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 12:00:26 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
				<category><![CDATA[Browser Compatibility]]></category>
		<category><![CDATA[Elements]]></category>
		<category><![CDATA[Structure]]></category>
		<category><![CDATA[details]]></category>
		<category><![CDATA[figure]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[legend]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=646</guid>
		<description><![CDATA[Lately I decided I was going to recreate the interactive features of the details element using JavaScript (apparently the same day as fellow Brightonian Jeremy Keith). However I ran in to some very serious issues with the tag, so serious, in it’s current state, it’s unusable.]]></description>
			<content:encoded><![CDATA[<p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
            <a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F">
                <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
            </a>
        </div>Lately I decided I was going to recreate the interactive features of the <code>details</code> element using JavaScript (apparently <a href="http://twitter.com/adactio/status/2869549874">the same day</a> as fellow Brightonian <a href="http://adactio.com/" title="Adactio: Jeremy Keith">Jeremy Keith</a>).</p>

<p>However I ran in to some very serious issues with the tag, so serious, in it&#8217;s current state, it&#8217;s unusable.</p>

<p><span id="more-646"></span></p>

<h2>Overview of the details element</h2>

<p>The <code>details</code> element, by default, is a collapsed element whose summary, or label, is the first child <code>legend</code> (if no <code>legend</code> is used, the UA provides a default, such as &#8220;Details&#8221;), with a triangular button to indicate it&#8217;s current open state.</p>

<p>If you include the <code>open</code> attribute, then the element is open by default.  In theory, you could attach a click event to the legend, and switch the <code>open</code> attribute.</p>

<p>The markup would roughly be this:</p>

<pre><code>&lt;details open=&quot;open&quot;&gt;
  &lt;legend&gt;Terms &amp; Conditions&lt;/legend&gt;
  &lt;p&gt;You agree to xyz, etc.&lt;/p&gt;
&lt;/details&gt;</code></pre>

<p>Here&#8217;s the details test page I was working from: <a href="http://remysharp.com/demo/details.html">HTML 5 details test</a></p>

<h2>The issues</h2>

<p>The biggest problem, and the show stopper for me, is that the browser&#8217;s treatment of the <code>legend</code> element completely breaks this markup pattern &#8211; this is true for <strong>all</strong> the major browsers: Opera, Safari, Firefox and IE (tested in all the latest and some older browsers).  I&#8217;ll go in these issues in detail in a moment.</p>

<p>Other problems include:</p>

<ul>
<li>Styling the legend element is exceptionally difficult, particularly positioning</li>
<li>Using the <a href="http://www.whatwg.org/" title="Web Hypertext Application Technology Working Group">WHATWG</a> <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#the-details-element-0">guidelines to styling</a> the <code>details</code> element prove both difficult to interpret and difficult to implement.</li>
<li>When using CSS to style the open state of the <code>details</code> element using: <code>details[open] { height: auto; }</code>, meant that once I changed the open state using JavaScript, it wouldn&#8217;t trigger the browser to redraw (as it would if I had added a class). I&#8217;ve <a href="http://twitter.com/rem/status/2178972149">run in to this before</a>, CSS 2.1 is styling source, not the DOM.</li>
</ul>

<h2>Legend treatment</h2>

<p>Surprisingly Firefox is the worst one out in these issues, the rest of the browsers have fairly same treatment of the issue.  In the screenshots, I&#8217;ve included a <code>fieldset</code> and nested <code>legend</code> for reference.</p>

<h3>Internet Explorer</h3>

<p>IE7 &#038; IE8 closes the <code>legend</code> element it encounters when it&#8217;s not inside a <code>fieldset</code> element and move it&#8217;s contents out to an adjacent text node.</p>

<p>What&#8217;s also strange, is that looking at the DOM it also creates another empty(?) closed <code>legend</code> element after that text node.  It doesn&#8217;t have any effect, but just looked odd:</p>

<p><img src="http://remysharp.com/wp-content/uploads/2009/07/ies-details-element-treatment.jpg" alt="IE's details element treatment" /></p>

<h3>Opera</h3>

<p>Opera (9 &#038; 10b) is very similar to IE in it&#8217;s treatment of the <code>legend</code> in the details element, except it doesn&#8217;t create the second closing <code>legend</code> node.  It just closes the <code>legend</code>, and creates the adjacent text node.</p>

<h3>Safari</h3>

<p>Safari simply strips the <code>legend</code> all together out of the DOM.  So much so, that if you open the web inspector, then the error console, you&#8217;ll see it warning out that it&#8217;s encountered an illegal element, ignoring it, then encountering the closing tag, so it ignores that too.  You&#8217;re left with just the text node.</p>

<h3>Firefox</h3>

<p>The best for last.  Firefox goes one step beyond the other browsers.  It assumes you&#8217;ve forgotten to include the <code>fieldset</code> element.  So when it hits the <code>legend</code> element, Firefox inserts an opening <code>fieldset</code> up until it finds (I believe) the closing <code>fieldset</code> element, which obviously it <em>doesn&#8217;t</em> so the result is the rest of the DOM, after the first illegally placed <code>legend</code> ends up eaten by <code>fieldset</code> element, which leaves my DOM in a mess:</p>

<p><img src="http://remysharp.com/wp-content/uploads/2009/07/firefox-details-treatment.jpg" alt="Firefox details treatment" /></p>

<h2>Impact on other elements</h2>

<p><code>details</code> isn&#8217;t the only element that reuses the <code>legend</code> element for labelling, the <code>figure</code> element also is <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-0.html#the-figure-element">supposed to support</a> the <code>legend</code> element.  The result is obviously going to be the same.</p>

<h2>Conclusion</h2>

<p>We can&#8217;t style the legend element when the text is being thrown out by all the browsers, and Firefox&#8217;s DOM mangling is just too painful to look at.</p>

<p>This basically means that we can&#8217;t, in any reasonable amount of time, use the <code>legend</code> element inside both the <code>details</code> and <code>figure</code> element in the spec&#8217;s current state.</p>

<p>For me, I&#8217;ll be using an alternative element, probably just a <code>p</code> element styled to look like a <code>legend</code>, but that&#8217;s really not the point.  Ideas anyone?</p>

<p>It turns out we weren&#8217;t the only ones looking at this and <a href="http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2009-July/021494.html">Ian Hickson</a> has responded on the issue:</p>

<blockquote cite="http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2009-July/021494.html"><p>My plan here is to continue to wait for a while longer to see if the parsing issues can get ironed out (the HTML5 parser in Gecko for instance solves this problem for Firefox). If we really can&#8217;t get past this, we&#8217;ll have to introduce a new element, but I&#8217;m trying to avoid going there.</p></blockquote>

<p>It&#8217;s fine to think that Gecko will update, but it&#8217;s IE that I&#8217;m worried about, they <em>won&#8217;t</em> turn out their render engine, and the result is we&#8217;ll <em>have</em> to avoid using the <code>legend</code> in any element other than <code>fieldset</code>.<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/dd-details-wrong-again/" rel="bookmark" class="crp_title">dd-details wrong again</a></li><li><a href="http://html5doctor.com/summary-figcaption-element/" rel="bookmark" class="crp_title">Hello, summary and figcaption elements</a></li><li><a href="http://html5doctor.com/september-html5-spec-changes/" rel="bookmark" class="crp_title">September HTML5 spec changes</a></li><li><a href="http://html5doctor.com/speaking/" rel="bookmark" class="crp_title">HTML5 Doctor Speaking and Training Appearances</a></li><li><a href="http://html5doctor.com/the-figure-figcaption-elements/" rel="bookmark" class="crp_title">The figure &#038; figcaption elements</a></li></ul></div></p>

<p>Share and Save:</p>

<pre><code>&lt;a rel="nofollow"  href="http://twitter.com/home?status=Legend%20not%20such%20a%20legend%20anymore%20-%20http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F" title="Twitter"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;title=Legend%20not%20such%20a%20legend%20anymore&amp;amp;bodytext=Lately%20I%20decided%20I%20was%20going%20to%20recreate%20the%20interactive%20features%20of%20the%20details%20element%20using%20JavaScript%20%28apparently%20the%20same%20day%20as%20fellow%20Brightonian%20Jeremy%20Keith%29.%20However%20I%20ran%20in%20to%20some%20very%20serious%20issues%20with%20the%20tag%2C%20so%20serious%2C%20in%20it%E2%80%99s%20current%20state%2C%20it%E2%80%99s%20unusable." title="Digg"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;amp;m=submit&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F" title="Sphinn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;title=Legend%20not%20such%20a%20legend%20anymore" title="Reddit"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;title=Legend%20not%20such%20a%20legend%20anymore&amp;amp;notes=Lately%20I%20decided%20I%20was%20going%20to%20recreate%20the%20interactive%20features%20of%20the%20details%20element%20using%20JavaScript%20%28apparently%20the%20same%20day%20as%20fellow%20Brightonian%20Jeremy%20Keith%29.%20However%20I%20ran%20in%20to%20some%20very%20serious%20issues%20with%20the%20tag%2C%20so%20serious%2C%20in%20it%E2%80%99s%20current%20state%2C%20it%E2%80%99s%20unusable." title="del.icio.us"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;title=Legend%20not%20such%20a%20legend%20anymore" title="StumbleUpon"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F" title="Technorati"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.netvibes.com/share?title=Legend%20not%20such%20a%20legend%20anymore&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F" title="Netvibes"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;t=Legend%20not%20such%20a%20legend%20anymore" title="Facebook"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;title=Legend%20not%20such%20a%20legend%20anymore&amp;amp;annotation=Lately%20I%20decided%20I%20was%20going%20to%20recreate%20the%20interactive%20features%20of%20the%20details%20element%20using%20JavaScript%20%28apparently%20the%20same%20day%20as%20fellow%20Brightonian%20Jeremy%20Keith%29.%20However%20I%20ran%20in%20to%20some%20very%20serious%20issues%20with%20the%20tag%2C%20so%20serious%2C%20in%20it%E2%80%99s%20current%20state%2C%20it%E2%80%99s%20unusable." title="Google Bookmarks"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.friendfeed.com/share?title=Legend%20not%20such%20a%20legend%20anymore&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F" title="FriendFeed"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;t=Legend%20not%20such%20a%20legend%20anymore" title="HackerNews"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;title=Legend%20not%20such%20a%20legend%20anymore&amp;amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;amp;summary=Lately%20I%20decided%20I%20was%20going%20to%20recreate%20the%20interactive%20features%20of%20the%20details%20element%20using%20JavaScript%20%28apparently%20the%20same%20day%20as%20fellow%20Brightonian%20Jeremy%20Keith%29.%20However%20I%20ran%20in%20to%20some%20very%20serious%20issues%20with%20the%20tag%2C%20so%20serious%2C%20in%20it%E2%80%99s%20current%20state%2C%20it%E2%80%99s%20unusable." title="LinkedIn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;h=Legend%20not%20such%20a%20legend%20anymore" title="NewsVine"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;amp;u=http%3A%2F%2Fhtml5doctor.com%2Flegend-not-such-a-legend-anymore%2F&amp;amp;t=Legend%20not%20such%20a%20legend%20anymore&amp;amp;s=Lately%20I%20decided%20I%20was%20going%20to%20recreate%20the%20interactive%20features%20of%20the%20details%20element%20using%20JavaScript%20%28apparently%20the%20same%20day%20as%20fellow%20Brightonian%20Jeremy%20Keith%29.%20However%20I%20ran%20in%20to%20some%20very%20serious%20issues%20with%20the%20tag%2C%20so%20serious%2C%20in%20it%E2%80%99s%20current%20state%2C%20it%E2%80%99s%20unusable." title="Tumblr"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /&gt;&lt;/a&gt;
</code></pre>

<p>&lt;br/>&lt;br/></p>
<p><a href="http://html5doctor.com/legend-not-such-a-legend-anymore/" rel="bookmark">Legend not such a legend anymore</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on July 31, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/legend-not-such-a-legend-anymore/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Accessibility &amp; Native Drag and Drop</title>
		<link>http://html5doctor.com/accessibility-native-drag-and-drop/</link>
		<comments>http://html5doctor.com/accessibility-native-drag-and-drop/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 13:30:32 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[JavaScript APIs]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=603</guid>
		<description><![CDATA[A few days before my native drag and drop article came out Gez Lemon wrote about accessibility in drag and drop, and touched on HTML 5. I then promised to look at implementing accessibility with native drag and drop, and here's my findings.]]></description>
			<content:encoded><![CDATA[<p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
            <a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F">
                <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
            </a>
        </div>A few days before my <a href="http://html5doctor.com/native-drag-and-drop/">native drag and drop</a> article came out <a href="http://juicystudio.com/">Gez Lemon</a> wrote about <a href="http://dev.opera.com/articles/view/accessible-drag-and-drop/">accessibility in drag and drop</a>, and touched on HTML 5.</p>

<p>I then promised to look at implementing accessibility with <em>native</em> drag and drop, and here&#8217;s my findings.</p>

<p><span id="more-603"></span></p>

<h2>ARIA Support</h2>

<p>This was quite easy to add, though only by following Gez&#8217;s article.  Since I already had events for drag start, I just needed to add drag end to clean up and remove the ARIA effects.</p>

<p>I added the following to the <code>dragstart</code> event:</p>

<pre><code>addEvent(dragItems, 'dragstart', function (event) {
  // via ARIA say the element has been grabbed
  this.setAttribute('aria-grabbed', 'true');
  // code continues...</code></pre>

<p>The added a new <code>dropend</code> event:</p>

<pre><code>addEvent(dragItems, 'dragend', function (event) {
  // remove the ARIA grab attibute when we're not dragging
  this.setAttribute('aria-grabbed', 'false');
});</code></pre>

<p>The <code>effectAllowed</code> and <code>dropEffect</code> combo was difficult to work out at first, though probably because I was playing with <code>link</code> and <code>reference</code>, whereas I should have been playing with <code>move</code> or <code>copy</code>.  That said, a note about <code>move</code> and <code>copy</code>, move is a type of copy, with a clean up function to delete afterwards.  Once I had this combo correct, the drop effects worked.</p>

<p>The changes required were to:</p>

<ol>
<li>On drag: on all the drop targets add: <code>setAttribute('aria-dropeffect', 'copy')</code></li>
<li>On drag: set the allowedEffect on the drag event: <code>event.dataTransfer.effectAllowed = 'copy';</code></li>
<li>On drop: say what we&#8217;ll accept: <code>event.dataTransfer.dropEffect = 'move';</code></li>
<li>On dragend: remove the drop effect from the drop targets: <code>removeAttribute('aria-dropeffect')</code></li>
</ol>

<p>The big problem for me was that I couldn&#8217;t truely test this.</p>

<p><strong>Update:</strong> between the time I had finished my code and writing this article, <a href="http://www.nvda-project.org/" title="NVDA">NVDA</a> (the Windows open source screenreader) announced that they recieved support from Yahoo!, and that ARIA drag and drop support is in their development roadmap.</p>

<p>The full working version of native drag and drop with ARIA support is available here: <a href="http://jsbin.com/obiqi">native drag and drop with ARIA support</a> (<a href="http://jsbin.com/obiqi/edit#html">source code</a>)</p>

<h2>Keyboard Support</h2>

<p>Keyboard, sadly, is a whole different story.</p>

<p>I was able to replicate a lot of the keyboard features that Gez included in his demo. This included setting the <code>tabIndex = 0</code> to allow the elements to tab to (superb trick by the way), included highlighting the drop targets as we drag.</p>

<p>However, the problem was: I wanted the user to be able to start the drag operation using the keyboard.  Initially looking at the spec I couldn&#8217;t see that it was supposed to be supported (which it turns out, it is).</p>

<p>I started going down the path of using the keyboard to trigger drag events.  I was able to replicate the drag event being triggered from the keyboard (like space starts the event), however, and this is a biggie, I couldn&#8217;t replicate the <code>dataTransfer</code> object.  I tried faking it.  I tried giving it nothing.  I tried all kinds of random attempts to trick the browser in to giving me the object.  It&#8217;s a no goer.</p>

<p>As it turns out, there <em>is</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/#copy-and-paste">keyboard support</a> written in to the spec (though in my personally opinion it&#8217;s not completely obvious to an author reading).  The drag and drop operations should work like a copy and paste operation.</p>

<p>This is very clever, and I like it.  Tab round to the dragable element, copy using the keyboard, which triggers the <code>dragstart</code> event, which I can then add classes to the drop targets, and make them tabbable.  The user then tabs round to the drop targets, and pastes.  This triggers the <code>drop</code> event and we&#8217;re all good.</p>

<p>No browsers support this keyboard event model.</p>

<p>I&#8217;ve raised bug for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=504533">Mozilla</a> and <a href="https://bugs.webkit.org/show_bug.cgi?id=27339">Webkit</a>.  They&#8217;ve both had comments on, and in both cases I&#8217;m not 100% sure what the comments mean, but speaking to the people involved via IRC, they&#8217;ve both said if it&#8217;s in the spec, it should be in the browser.</p>

<p>Let&#8217;s hope they do something about it. Now, how do I report a bug in IE&#8230;?!<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/native-drag-and-drop/" rel="bookmark" class="crp_title">Native Drag and Drop</a></li><li><a href="http://html5doctor.com/your-questions-answered-9/" rel="bookmark" class="crp_title">Your Questions Answered 9</a></li><li><a href="http://html5doctor.com/why-designers-should-care-about-html5/" rel="bookmark" class="crp_title">Why designers should care about HTML5</a></li><li><a href="http://html5doctor.com/designing-a-blog-with-html5/" rel="bookmark" class="crp_title">Designing a blog with html5</a></li><li><a href="http://html5doctor.com/your-questions-answered-4/" rel="bookmark" class="crp_title">Your Questions Answered #4</a></li></ul></div></p>

<p>Share and Save:</p>

<pre><code>&lt;a rel="nofollow"  href="http://twitter.com/home?status=Accessibility%20%26%20Native%20Drag%20and%20Drop%20-%20http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F" title="Twitter"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;title=Accessibility%20%26%20Native%20Drag%20and%20Drop&amp;amp;bodytext=A%20few%20days%20before%20my%20native%20drag%20and%20drop%20article%20came%20out%20Gez%20Lemon%20wrote%20about%20accessibility%20in%20drag%20and%20drop%2C%20and%20touched%20on%20HTML%205.%20I%20then%20promised%20to%20look%20at%20implementing%20accessibility%20with%20native%20drag%20and%20drop%2C%20and%20here%27s%20my%20findings." title="Digg"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;amp;m=submit&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F" title="Sphinn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;title=Accessibility%20%26%20Native%20Drag%20and%20Drop" title="Reddit"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;title=Accessibility%20%26%20Native%20Drag%20and%20Drop&amp;amp;notes=A%20few%20days%20before%20my%20native%20drag%20and%20drop%20article%20came%20out%20Gez%20Lemon%20wrote%20about%20accessibility%20in%20drag%20and%20drop%2C%20and%20touched%20on%20HTML%205.%20I%20then%20promised%20to%20look%20at%20implementing%20accessibility%20with%20native%20drag%20and%20drop%2C%20and%20here%27s%20my%20findings." title="del.icio.us"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;title=Accessibility%20%26%20Native%20Drag%20and%20Drop" title="StumbleUpon"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F" title="Technorati"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.netvibes.com/share?title=Accessibility%20%26%20Native%20Drag%20and%20Drop&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F" title="Netvibes"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;t=Accessibility%20%26%20Native%20Drag%20and%20Drop" title="Facebook"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;title=Accessibility%20%26%20Native%20Drag%20and%20Drop&amp;amp;annotation=A%20few%20days%20before%20my%20native%20drag%20and%20drop%20article%20came%20out%20Gez%20Lemon%20wrote%20about%20accessibility%20in%20drag%20and%20drop%2C%20and%20touched%20on%20HTML%205.%20I%20then%20promised%20to%20look%20at%20implementing%20accessibility%20with%20native%20drag%20and%20drop%2C%20and%20here%27s%20my%20findings." title="Google Bookmarks"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.friendfeed.com/share?title=Accessibility%20%26%20Native%20Drag%20and%20Drop&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F" title="FriendFeed"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;t=Accessibility%20%26%20Native%20Drag%20and%20Drop" title="HackerNews"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;title=Accessibility%20%26%20Native%20Drag%20and%20Drop&amp;amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;amp;summary=A%20few%20days%20before%20my%20native%20drag%20and%20drop%20article%20came%20out%20Gez%20Lemon%20wrote%20about%20accessibility%20in%20drag%20and%20drop%2C%20and%20touched%20on%20HTML%205.%20I%20then%20promised%20to%20look%20at%20implementing%20accessibility%20with%20native%20drag%20and%20drop%2C%20and%20here%27s%20my%20findings." title="LinkedIn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;h=Accessibility%20%26%20Native%20Drag%20and%20Drop" title="NewsVine"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;amp;u=http%3A%2F%2Fhtml5doctor.com%2Faccessibility-native-drag-and-drop%2F&amp;amp;t=Accessibility%20%26%20Native%20Drag%20and%20Drop&amp;amp;s=A%20few%20days%20before%20my%20native%20drag%20and%20drop%20article%20came%20out%20Gez%20Lemon%20wrote%20about%20accessibility%20in%20drag%20and%20drop%2C%20and%20touched%20on%20HTML%205.%20I%20then%20promised%20to%20look%20at%20implementing%20accessibility%20with%20native%20drag%20and%20drop%2C%20and%20here%27s%20my%20findings." title="Tumblr"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /&gt;&lt;/a&gt;
</code></pre>

<p>&lt;br/>&lt;br/></p>
<p><a href="http://html5doctor.com/accessibility-native-drag-and-drop/" rel="bookmark">Accessibility &#038; Native Drag and Drop</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on July 23, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/accessibility-native-drag-and-drop/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>2022, or when will HTML 5 be ready?</title>
		<link>http://html5doctor.com/2022-or-when-will-html-5-be-ready/</link>
		<comments>http://html5doctor.com/2022-or-when-will-html-5-be-ready/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 14:19:00 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
				<category><![CDATA[Browser Compatibility]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[Ian Hickson]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[WHATWG]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=548</guid>
		<description><![CDATA[Aside from being the year Queen Elizabeth II will celebrate her Platinum Jubilee, assuming she's still kicking around, 2022 is the year that's been inappropriate linked with HTML 5 in the minds of a lot of our community.  I understand why someone might think that, but it's wrong.  *2022* was misinterpreted as the year <abbr>HTML</abbr> 5 would be ready.  That's wrong.  <abbr>HTML</abbr> 5 is ready  <strong>today</strong>.]]></description>
			<content:encoded><![CDATA[<p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
            <a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F">
                <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
            </a>
        </div>Aside from being the year Queen Elizabeth II will celebrate her Platinum Jubilee, assuming she&#8217;s still kicking around, 2022 is the year that&#8217;s been inappropriate linked with HTML 5 in the minds of a lot of our community.  </p>

<p>I understand why someone might think that, but it&#8217;s wrong.  <em>2022</em> was misinterpreted as the year <abbr>HTML</abbr> 5 would be ready.  That&#8217;s wrong.  <abbr>HTML</abbr> 5 is ready  <strong>today</strong>.</p>

<p>In an <a href="http://blogs.techrepublic.com.com/programming-and-development/?p=718">interview by Tech Republic</a>, for a techie audience, <a href="http://ln.hixie.ch/" title="Hixie's Natural Log">Ian Hickson</a>, the editor of the HTML 5 working draft, was asked to give a timeline of the HTML 5 recommendation.</p>

<p>One date <em>should</em> have come out of that interview, but another, much further away did instead: 2022 &#8211; the date of the final proposed recommendation, which actually translates to: </p>

<blockquote>
  <p>require at least two browsers to completely pass [<abbr>HTML</abbr> 5 test suites]</p>
</blockquote>

<p>Let&#8217;s put this in context of another spec that has taken a very long time: <abbr>CSS</abbr> 2.1.</p>

<p><abbr>CSS</abbr> 2.1 is <abbr>CSS</abbr> that I&#8217;m <em>certain</em> you&#8217;re familiar with.  I&#8217;m <em>certain</em> you use it day to day without any thought as to whether it&#8217;s a completed spec.  </p>

<p>It&#8217;s been in development for over 10 years, and it&#8217;s <em>only just</em> become a candidate recommendation (23rd April 2009).  </p>

<p>That said, it <strong>doesn&#8217;t</strong> have two browsers completely supporting it.  Only Internet Explorer 8 supports the full <abbr>CSS</abbr> 2.1 spec.  </p>

<p>Did that stop you from using <abbr>CSS</abbr> 2.1?  I suspect not.  Will that stop us from using <abbr>HTML</abbr> 5?  It certainly shouldn&#8217;t. <abbr>HTML</abbr> 5 is available and ready to be used today.</p>

<h2>What <em>is</em> the important <abbr>HTML</abbr> 5 date?</h2>

<p><strong>October 2009</strong>.  </p>

<p>This October is the <em>last call</em> for the <abbr>HTML</abbr> 5 working draft.</p>

<p>That means, that issues with the spec, enhancements, bugs, anything, it all needs to be in and submitted and written in to the spec for October <em>this year</em> (it can go through reiterations, the this is the main deadline).</p>

<p>The <abbr>WHATWG</abbr> is completely open for <em>anyone</em> to contribute their ideas and suggestions.</p>

<p>You can sign up to the <a href="http://www.whatwg.org/mailing-list">mailing lists</a>, look through the backlog of mailing list. You can communicate directly <a href="irc://irc.freenode.net/whatwg">using <abbr>IRC</abbr></a> and there&#8217;s even a complete log of all the <a href="http://krijnhoetmer.nl/irc-logs/"><abbr>IRC</abbr> history</a>.  All available from <a href="http://whatwg.org">http://whatwg.org</a>.
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/dd-details-wrong-again/" rel="bookmark" class="crp_title">dd-details wrong again</a></li><li><a href="http://html5doctor.com/its-bug-report-time/" rel="bookmark" class="crp_title">It&#8217;s bug report time!</a></li><li><a href="http://html5doctor.com/html-5-boilerplates/" rel="bookmark" class="crp_title">HTML5 Boilerplates</a></li><li><a href="http://html5doctor.com/legend-not-such-a-legend-anymore/" rel="bookmark" class="crp_title">Legend not such a legend anymore</a></li><li><a href="http://html5doctor.com/your-questions-answered-6/" rel="bookmark" class="crp_title">Your Questions Answered #6</a></li></ul></div></p>

<p>Share and Save:</p>

<pre><code>&lt;a rel="nofollow"  href="http://twitter.com/home?status=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F%20-%20http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F" title="Twitter"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;title=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F&amp;amp;bodytext=Aside%20from%20being%20the%20year%20Queen%20Elizabeth%20II%20will%20celebrate%20her%20Platinum%20Jubilee%2C%20assuming%20she%27s%20still%20kicking%20around%2C%202022%20is%20the%20year%20that%27s%20been%20inappropriate%20linked%20with%20HTML%205%20in%20the%20minds%20of%20a%20lot%20of%20our%20community.%20%20I%20understand%20why%20someone%20might%20think%20that%2C%20but%20it%27s%20wrong.%20%20%2A2022%2A%20was%20misinterpreted%20as%20the%20year%20HTML%205%20would%20be%20ready.%20%20That%27s%20wrong.%20%20HTML%205%20is%20ready%20%20today." title="Digg"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;amp;m=submit&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F" title="Sphinn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;title=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F" title="Reddit"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;title=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F&amp;amp;notes=Aside%20from%20being%20the%20year%20Queen%20Elizabeth%20II%20will%20celebrate%20her%20Platinum%20Jubilee%2C%20assuming%20she%27s%20still%20kicking%20around%2C%202022%20is%20the%20year%20that%27s%20been%20inappropriate%20linked%20with%20HTML%205%20in%20the%20minds%20of%20a%20lot%20of%20our%20community.%20%20I%20understand%20why%20someone%20might%20think%20that%2C%20but%20it%27s%20wrong.%20%20%2A2022%2A%20was%20misinterpreted%20as%20the%20year%20HTML%205%20would%20be%20ready.%20%20That%27s%20wrong.%20%20HTML%205%20is%20ready%20%20today." title="del.icio.us"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;title=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F" title="StumbleUpon"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F" title="Technorati"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.netvibes.com/share?title=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F" title="Netvibes"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;t=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F" title="Facebook"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;title=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F&amp;amp;annotation=Aside%20from%20being%20the%20year%20Queen%20Elizabeth%20II%20will%20celebrate%20her%20Platinum%20Jubilee%2C%20assuming%20she%27s%20still%20kicking%20around%2C%202022%20is%20the%20year%20that%27s%20been%20inappropriate%20linked%20with%20HTML%205%20in%20the%20minds%20of%20a%20lot%20of%20our%20community.%20%20I%20understand%20why%20someone%20might%20think%20that%2C%20but%20it%27s%20wrong.%20%20%2A2022%2A%20was%20misinterpreted%20as%20the%20year%20HTML%205%20would%20be%20ready.%20%20That%27s%20wrong.%20%20HTML%205%20is%20ready%20%20today." title="Google Bookmarks"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.friendfeed.com/share?title=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F&amp;amp;link=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F" title="FriendFeed"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;t=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F" title="HackerNews"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;amp;url=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;title=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F&amp;amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;amp;summary=Aside%20from%20being%20the%20year%20Queen%20Elizabeth%20II%20will%20celebrate%20her%20Platinum%20Jubilee%2C%20assuming%20she%27s%20still%20kicking%20around%2C%202022%20is%20the%20year%20that%27s%20been%20inappropriate%20linked%20with%20HTML%205%20in%20the%20minds%20of%20a%20lot%20of%20our%20community.%20%20I%20understand%20why%20someone%20might%20think%20that%2C%20but%20it%27s%20wrong.%20%20%2A2022%2A%20was%20misinterpreted%20as%20the%20year%20HTML%205%20would%20be%20ready.%20%20That%27s%20wrong.%20%20HTML%205%20is%20ready%20%20today." title="LinkedIn"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;amp;save?u=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;h=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F" title="NewsVine"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /&gt;&lt;/a&gt;
&lt;a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;amp;u=http%3A%2F%2Fhtml5doctor.com%2F2022-or-when-will-html-5-be-ready%2F&amp;amp;t=2022%2C%20or%20when%20will%20HTML%205%20be%20ready%3F&amp;amp;s=Aside%20from%20being%20the%20year%20Queen%20Elizabeth%20II%20will%20celebrate%20her%20Platinum%20Jubilee%2C%20assuming%20she%27s%20still%20kicking%20around%2C%202022%20is%20the%20year%20that%27s%20been%20inappropriate%20linked%20with%20HTML%205%20in%20the%20minds%20of%20a%20lot%20of%20our%20community.%20%20I%20understand%20why%20someone%20might%20think%20that%2C%20but%20it%27s%20wrong.%20%20%2A2022%2A%20was%20misinterpreted%20as%20the%20year%20HTML%205%20would%20be%20ready.%20%20That%27s%20wrong.%20%20HTML%205%20is%20ready%20%20today." title="Tumblr"&gt;&lt;img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /&gt;&lt;/a&gt;
</code></pre>

<p>&lt;br/>&lt;br/></p>
<p><a href="http://html5doctor.com/2022-or-when-will-html-5-be-ready/" rel="bookmark">2022, or when will HTML 5 be ready?</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on July 21, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/2022-or-when-will-html-5-be-ready/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>HTML5 Boilerplates</title>
		<link>http://html5doctor.com/html-5-boilerplates/</link>
		<comments>http://html5doctor.com/html-5-boilerplates/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 13:30:45 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
				<category><![CDATA[Boilerplates]]></category>
		<category><![CDATA[Structure]]></category>
		<category><![CDATA[boilerplate]]></category>
		<category><![CDATA[doctype]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=526</guid>
		<description><![CDATA[
			
				
			
		
Without going into the discussion of why HTML 5 is available today and not 2022, this article is going to give you a series of HTML 5 boilerplates that you can use in your projects right now.
HTML 5 in 5 seconds
It&#8217;s &#252;ber easy to get your markup to validate as HTML 5 &#8212; just change [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>Without going into the discussion of why <abbr>HTML</abbr> 5 is available <em>today</em> and not 2022, this article is going to give you a series of <abbr>HTML</abbr> 5 boilerplates that you can use in your projects <em>right now</em>.</p>
<h2 id="html_5_in_5_seconds"><abbr>HTML</abbr> 5 in 5 seconds</h2>
<p>It&#8217;s &uuml;ber easy to get your markup to validate as <abbr>HTML</abbr> 5 &mdash; just change your <code>DOCTYPE</code> from whatever it is now to this:</p>
<pre><code>&lt;!DOCTYPE html&gt;</pre>
<p></code></p>
<p>That's it! It doesn't require anything more than that.</p>
<p>Google are doing it already. Check out their homepage, written all in one line:</p>
<pre><code>&lt;!doctype html&gt;&lt;head&gt;&lt;title&gt;HTML 5 - Google Search&lt;/title&gt;&lt;script&gt;...</code></pre>
<p>Ironically, Google's search and results pages don't validate because of their use of invalid tags like <code>&lt;font&gt;</code> and a number of other errors, but that's okay. They can still take advantage of the <abbr>HTML</abbr> 5 parsing rules (e.g., no <code>type</code> attribute on the <code>&lt;script&gt;</code> element) by using the correct <code>DOCTYPE</code>.</p>
<h2 id="html_5_minified"><abbr>HTML</abbr> 5 minified</h2>
<p>If you like to knock out quick prototypes or experiments that don't require much styling, you might be interested in a miniature document in <abbr>HTML</abbr> 5:</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;title&gt;Small HTML 5&lt;/title&gt;
&lt;p&gt;Hello world&lt;/p&gt;</code></pre>
<p>That's <a href="http://validator.w3.org/check?uri=http%3A%2F%2Fjsbin.com%2Fowata&amp;ss=1">completely valid <abbr>HTML</abbr> 5</a> too.</p>
<p>(Interestingly, there was some disagreement about this pattern's validity when I removed the <code>&lt;title&gt;</code> tag. <a href="http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cp%3EHello%20World%3C%2Fp%3E">Hixie's DOM viewer</a> says it's fine, and so does the W3C validator as long as the markup is entered manually. But Henri Sivonen's validator says it's invalid without the <code>&lt;title&gt;</code> tag. The W3C validator also says it's invalid when you <a href="http://validator.w3.org/check?uri=http%3A%2F%2Fjsbin.com%2Feyuqe&amp;ss=1">give it a url</a>. Hopefully, this will get sorted out soon.)</p>
<h2 id="html_5_complete_compatible"><abbr>HTML</abbr> 5 complete &amp; compatible</h2>
<p>This final, more complete boilerplate also indicates the character set. Without it, some characters will not render properly (and I've spent too much time in the past trying to work out why!).</p>
<p>We're also including the <a href="http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/"><abbr>HTML</abbr> 5 shiv</a> so that we can style elements in IE. Note that <a href="http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/#a-little-head">you <em>must</em> include this script in the <code>&lt;head&gt;</code> element</a>.</p>
<p>Finally, we're adding a few <abbr>CSS</abbr> rules to cause the new block-level elements to render as such, since some browsers don't know about them natively.</p>
<p>So here it is &mdash; a valid and complete HTML 5 document boilerplate:</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset=&quot;utf-8&quot; /&gt;
&lt;title&gt;HTML 5 complete&lt;/title&gt;
&lt;!--[if IE]&gt;
&lt;script src=&quot;http://html5shiv.googlecode.com/svn/trunk/html5.js&quot;&gt;&lt;/script&gt;
&lt;![endif]--&gt;
&lt;style&gt;
  article, aside, details, figcaption, figure, footer, header,
  hgroup, menu, nav, section { display: block; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;Hello World&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>If you want to experiment with <abbr>HTML</abbr> 5, the <a href="http://jsbin.com/">default JS Bin template</a> is an HTML5 boilerplate for you to play with too.</p>
<div id="crp_related">
<h3>Related Posts:</h3>
<ul>
<li><a href="http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/" rel="bookmark" class="crp_title">How to get HTML5 working in IE and Firefox 2</a></li>
<li><a href="http://html5doctor.com/absent-elements-and-validation/" rel="bookmark" class="crp_title">Absent Elements and Validation</a></li>
<li><a href="http://html5doctor.com/native-drag-and-drop/" rel="bookmark" class="crp_title">Native Drag and Drop</a></li>
<li><a href="http://html5doctor.com/how-to-use-html5-in-your-client-work-right-now/" rel="bookmark" class="crp_title">How to use HTML5 in your client work right now</a></li>
<li><a href="http://html5doctor.com/block-level-links-in-html-5/" rel="bookmark" class="crp_title">&#8220;Block-level&#8221; links in HTML5</a></li>
</ul>
</div>
<p>Share and Save:</p>
<p>	<a rel="nofollow"  href="http://twitter.com/home?status=HTML5%20Boilerplates%20-%20http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;title=HTML5%20Boilerplates&amp;bodytext=Without%20going%20into%20the%20discussion%20of%20why%20HTML%205%20is%20available%20today%20and%20not%202022%2C%20this%20article%20is%20going%20to%20give%20you%20a%20series%20of%20HTML%205%20boilerplates%20that%20you%20can%20use%20in%20your%20projects%20right%20now.%0D%0A%0D%0AHTML%205%20in%205%20seconds%0D%0A%0D%0AIt%27s%20%26uuml%3Bber%20easy%20to%20get%20your%20" title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;title=HTML5%20Boilerplates" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;title=HTML5%20Boilerplates&amp;notes=Without%20going%20into%20the%20discussion%20of%20why%20HTML%205%20is%20available%20today%20and%20not%202022%2C%20this%20article%20is%20going%20to%20give%20you%20a%20series%20of%20HTML%205%20boilerplates%20that%20you%20can%20use%20in%20your%20projects%20right%20now.%0D%0A%0D%0AHTML%205%20in%205%20seconds%0D%0A%0D%0AIt%27s%20%26uuml%3Bber%20easy%20to%20get%20your%20" title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;title=HTML5%20Boilerplates" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=HTML5%20Boilerplates&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;t=HTML5%20Boilerplates" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;title=HTML5%20Boilerplates&amp;annotation=Without%20going%20into%20the%20discussion%20of%20why%20HTML%205%20is%20available%20today%20and%20not%202022%2C%20this%20article%20is%20going%20to%20give%20you%20a%20series%20of%20HTML%205%20boilerplates%20that%20you%20can%20use%20in%20your%20projects%20right%20now.%0D%0A%0D%0AHTML%205%20in%205%20seconds%0D%0A%0D%0AIt%27s%20%26uuml%3Bber%20easy%20to%20get%20your%20" title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=HTML5%20Boilerplates&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;t=HTML5%20Boilerplates" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;title=HTML5%20Boilerplates&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=Without%20going%20into%20the%20discussion%20of%20why%20HTML%205%20is%20available%20today%20and%20not%202022%2C%20this%20article%20is%20going%20to%20give%20you%20a%20series%20of%20HTML%205%20boilerplates%20that%20you%20can%20use%20in%20your%20projects%20right%20now.%0D%0A%0D%0AHTML%205%20in%205%20seconds%0D%0A%0D%0AIt%27s%20%26uuml%3Bber%20easy%20to%20get%20your%20" title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;h=HTML5%20Boilerplates" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-boilerplates%2F&amp;t=HTML5%20Boilerplates&amp;s=Without%20going%20into%20the%20discussion%20of%20why%20HTML%205%20is%20available%20today%20and%20not%202022%2C%20this%20article%20is%20going%20to%20give%20you%20a%20series%20of%20HTML%205%20boilerplates%20that%20you%20can%20use%20in%20your%20projects%20right%20now.%0D%0A%0D%0AHTML%205%20in%205%20seconds%0D%0A%0D%0AIt%27s%20%26uuml%3Bber%20easy%20to%20get%20your%20" title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
<p><a href="http://html5doctor.com/html-5-boilerplates/" rel="bookmark">HTML5 Boilerplates</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on July 17, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/html-5-boilerplates/feed/</wfw:commentRss>
		<slash:comments>82</slash:comments>
		</item>
		<item>
		<title>Native Drag and Drop</title>
		<link>http://html5doctor.com/native-drag-and-drop/</link>
		<comments>http://html5doctor.com/native-drag-and-drop/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 09:00:13 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
				<category><![CDATA[JavaScript APIs]]></category>
		<category><![CDATA[draganddrop]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=397</guid>
		<description><![CDATA[
			
				
			
		
Along with an army of JavaScript APIs, HTML 5 comes with a Drag and Drop (DnD) API that brings native DnD support to the browser making it much easier to code up.  
HTML 5 DnD is based on Microsoft&#8217;s original implementation which was available as early as Internet Explorer 5!  Now currently supported [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>Along with an army of JavaScript APIs, <abbr>HTML</abbr> 5 comes with a <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#dnd">Drag and Drop</a> (<abbr title="Drag and Drop as referred to in the HTML5 specs">DnD</abbr>) API that brings native DnD support to the browser making it much easier to code up.  </p>
<p><abbr>HTML</abbr> 5 <abbr title="Drag and Drop">DnD</abbr> is based on Microsoft&#8217;s original implementation which was available as early as Internet Explorer 5!  Now currently supported in <abbr>IE</abbr>, Firefox 3.5 and Safari 4.</p>
<p>We&#8217;re going to look how to implement <abbr title="Drag and Drop">DnD</abbr> and review some of the issues (or hoops we have to jump through) with the current implementations now.</p>
<p><span id="more-397"></span></p>
<h2 id="my_first_drag_and_drop">My First Drag and Drop</h2>
<p>DnD requires only a few things to work:</p>
<ul>
<li>Something to drag</li>
<li>A drop target</li>
<li>JavaScript event handlers on the target to tell the browser it can drop</li>
</ul>
<p>The following elements are draggable by default: <code>&lt;img&gt;</code> elements and <code>&lt;a&gt;</code> elements (with an href).</p>
<p>If you want to drag a different element, you need to set the <code>draggable</code> attribute to <code>true</code>. That&#8217;s according to the spec, but to get it to work in Safari and Firefox there&#8217;s a little more that you need to do, which we&#8217;ll come on to.</p>
<p>If you want to skip the code walk through, here&#8217;s the <a href="http://jsbin.com/ezuke">simple drag and drop</a> (<a href="http://jsbin.com/ezuke/edit">source code</a>)</p>
<p>Here&#8217;s our example markup:</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
&lt;meta charset=utf-8 /&gt;
&lt;title&gt;Basic Drag and Drop&lt;/title&gt;
&lt;style&gt;
#drop {
  min-height: 100px;
  width: 200px;
  border: 3px dashed #ccc;
  margin: 10px;
  padding: 10px;
}
p {
  margin: 3px 0;
}
&lt;/style&gt;
&lt;script src=&quot;http://html5demos.com/h5utils.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;img src=&quot;http://twivatar.org/rem&quot; alt=&quot;Remy Sharp&quot; /&gt;
  &lt;img src=&quot;http://twivatar.org/brucel&quot; alt=&quot;Bruce Lawson&quot; /&gt;
  &lt;img src=&quot;http://twivatar.org/Rich_Clark&quot; alt=&quot;Rich Clark&quot; /&gt;
  &lt;div id=&quot;drop&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p><small>Note: the included <a href="http://html5demos.com/h5utils.js">h5utils.js</a> script is a small library to trigger <abbr>HTML</abbr> 5 elements and to give me cross browser event binding.</small></p>
<p>Currently the <code>&lt;img&gt;</code> elements can be dragged, but they can&#8217;t be dropped (this is the browser&#8217;s default).</p>
<p>To <em>drop</em> elements we need to:</p>
<ol>
<li>Tell the browser that the element can be dragged over a specific point</li>
<li>Handle the drop event</li>
</ol>
<p>To tell the browser we <em>can</em> drop in this element, all we have to do is cancel the <code>dragover</code> event.  However, since <abbr>IE</abbr> behaves differently, we need to do the same thing for the <code>dragenter</code> event.</p>
<p>Here&#8217;s the code for basic drop handling:</p>
<pre><code>var drop = document.querySelector(&#x27;#drop&#x27;);

// Tells the browser that we *can* drop on this target
addEvent(drop, &#x27;dragover&#x27;, cancel);
addEvent(drop, &#x27;dragenter&#x27;, cancel);

addEvent(drop, &#x27;drop&#x27;, function (event) {
  // stops the browser from redirecting off to the text.
  if (event.preventDefault) {
    event.preventDefault();
  }

  this.innerHTML += &#x27;&lt;p&gt;&#x27; + event.dataTransfer.getData(&#x27;Text&#x27;) + &#x27;&lt;/p&gt;&#x27;;

  return false;
});

function cancel(event) {
  if (event.preventDefault) {
    event.preventDefault();
  }
  return false;
}</code></pre>
<p><small>Note for this code, I&#8217;m using <code>addEvent</code> where you&#8217;d normally see <code>element.addEventListener</code>, it&#8217;s from the <a href="http://html5demos.com/h5utils.js">h5utils.js</a> library to support <abbr>IE</abbr>.</small></p>
<p>In the JavaScript we are:</p>
<ol>
<li>Searching for the drop target in the <abbr>DOM</abbr> using <code>document.querySelector</code> (which returns the first result only)</li>
<li>When <code>dragover</code> event is fired (when the user drags the element over another), it will trigger the function called &#8216;cancel&#8217; (at the bottom of the code above) which will prevent the default browser action</li>
<li>Do the same for <code>dragenter</code> to support <abbr>IE</abbr></li>
<li>Bind the <code>drop</code> event, and within there grab some data about what was dropped.</li>
</ol>
<h3 id="dragover_dragenter">dragover &amp; dragenter</h3>
<p>By cancelling this event, we&#8217;re telling the browser <em>this</em> element that we&#8217;re over is the one you can release and drop upon.</p>
<p>I&#8217;m still not entirely sure why there&#8217;s a difference here, but Firefox and friends needs <code>preventDefault</code> on the event, and <abbr>IE</abbr> requires the <code>return false</code>.  Note that the examples out in the wild that use inline JavaScript (yuk, bad), the <code>preventDefault</code> is supposed to be implicit, so you won&#8217;t see it in the code.</p>
<h3 id="drop">drop</h3>
<p>To show what was dropped, we need to do two things:</p>
<ol>
<li>Cancel the default browser action. This is to ensure that if we drop a link, the browser doesn&#8217;t go off and surf to that location</li>
<li>Get the contents out of the <code>dataTransfer</code> object</li>
</ol>
<p>The cancelling of the browser default is, again, done using the <code>preventDefault</code> <em>and</em> <code>return false</code>.</p>
<p>If we don&#8217;t set the <code>dataTransfer</code> data manually (which I&#8217;ll show you later), the default key is set to <em>Text</em>.  So this might be the value of an href of an <code>&lt;a&gt;</code> element, or it might be <code>&lt;img&gt;</code> src address.</p>
<h2 id="doing_more_with_drag8217n_drop">Doing More with Drag&#8217;n Drop</h2>
<p>There&#8217;s a number of extra bits in the spec other than just dragging images.</p>
<p>Here&#8217;s a few bits that I can see being useful:</p>
<ol>
<li>Being able to drag <em>any</em> element</li>
<li>More complex data types, other than text</li>
<li>Set a different drag icon/image when dragging the element</li>
</ol>
<h3 id="dragging_anything">Dragging Anything</h3>
<p>If we change the <code>&lt;img&gt;</code> to <code>&lt;div&gt;</code> tags with background images, I still want to be able to drag them around the page, and drop them in to my container.</p>
<p>The <abbr>HTML</abbr> 5 spec says it should be as simple as adding the following attributes to the markup of the elements in question:</p>
<pre><code>draggable="true"</code></pre>
<p>However, this doesn&#8217;t work completely for Safari or Firefox.  </p>
<p>For Safari you need to add the following style to the element:</p>
<pre><code>[draggable=true] {
  -khtml-user-drag: element;
}</code></pre>
<p>This will start working in Safari, and as you drag it will set a default, empty value with the <code>dataTransfer</code> object.  <em>However</em>, Firefox won&#8217;t allow you to drag the element unless you manually set some data to go with it.</p>
<p>To solve this, we need a <code>dragstart</code> event handler, and we&#8217;ll give it some data to be dragged around with:</p>
<pre><code>var dragItems = document.querySelectorAll('[draggable=true]');

for (var i = 0; i < dragItems.length; i++) {
  addEvent(dragItems[i], 'dragstart', function (event) {
    // store the ID of the element, and collect it on the drop later on
    event.dataTransfer.setData('Text', this.id);
  });
}</code></pre>
<p>Here&#8217;s a working demo of <a href="http://jsbin.com/uzovu">drag and drop <em>anything</em></a> (<a href="http://jsbin.com/uzovu/edit">source code</a>)</p>
<h3 id="more_complex_data_types">More Complex Data Types</h3>
<p>You&#8217;ve already seen how we can use <code>dataTransfer.setData(<em>format</em>, <em>string</em>)</code> to associate some data in the example above. </p>
<p>You can also use this key/value pair to store more data, but you&#8217;re limited to storing strings only.</p>
<p>One way I would get around this is to have a data lookup, where the key of the lookup may be the ID of the element, and then I can de-reference the data on the drop event.</p>
<p>For example:</p>
<pre><code>var people = {
  rem : {
    name : "Remy Sharp",
    blog : "http://remysharp.com"
  },
  brucel : {
    name : "Bruce Lawson",
    blog : "http://brucelawson.co.uk"
  }
  // etc...
}

var dragItems = document.querySelectorAll('[draggable=true]');

for (var i = 0; i < dragItems.length; i++) {
  addEvent(dragItems[i], 'dragstart', function (event) {
    // store the ID of the element, and collect it on the drop later on
    event.dataTransfer.setData('Text', this.id);
  });
}

addEvent(drop, &#x27;drop&#x27;, function (event) {
  // stops the browser from redirecting off to the text.
  if (event.preventDefault) {
    event.preventDefault();
  }

  var person = people[event.dataTransfer.getData(&#x27;Text&#x27;)];

  this.innerHTML += &#x27;&lt;p&gt;&lt;a href=&quot;&#x27; + person.blog + &quot;&gt;' + person.name + '&lt;/a&gt;&lt;/p&gt;&#x27;;

  return false;
});</code></pre>
<p>Here&#8217;s a working demo of <a href="http://jsbin.com/afica">drag and drop with associated data</a> (<a href="http://jsbin.com/afica/edit">source code</a>)</p>
<p>Obviously this isn&#8217;t the most ideal situation, but there&#8217;s also the possibility to set other content types in the drag data, which should produce some interesting apps in the future.</p>
<h3 id="drag_icon">Drag Icon</h3>
<p>Along with several other options with the <code>dragstart</code> event, you can also set a drag image, i.e. what you see under your cursor.</p>
<p>You can create a <abbr>DOM</abbr> fragment, and then associate the fragment with the <code>dataTransfer</code> using <code>setDragImage(<em>element</em>, <em>x</em>, <em>y</em>)</code>.</p>
<p>So we can add the following to our example to use a custom drag image:</p>
<pre><code>var dragIcon = document.createElement('img');
dragIcon.src = 'http://twivatar.org/twitter/mini';</code></pre>
<p>Which creates an image element, and how within the <code>dragstart</code> event, we&#8217;ll set the drag image:</p>
<pre><code>addEvent(dragItems[i], 'dragstart', function (event) {
  // store the ID of the element, and collect it on the drop later on
  event.dataTransfer.setData('Text', this.id);
  <strong>event.dataTransfer.setDragImage(dragIcon, -10, -10);</strong>
  return false;
});</code></pre>
<p>This sets the custom drag icon 10 pixels below the cursor, as seen in this example: <a href="http://jsbin.com/ijeza">drag and drop with custom image</a> (<a href="http://jsbin.com/ijeza">source code</a>)</p>
<h2 id="native_drag">Native Drag</h2>
<p>There&#8217;s lots of Drag and Drop JavaScript libraries available, but what <em>I&#8217;d</em> like to see, is native <abbr title="Drag and Drop">DnD</abbr> support falling back to library based.  However, I know for a fact that some libraries, including jQuery, construct a custom event when passed in to the event handler which means, <em>currently</em>, you can&#8217;t use the <code>dataTransfer</code> object, so you&#8217;ll have to rely on binding the events yourself.  I&#8217;m sure this will change soon.</p>
<p>There&#8217;s lots more in Drag and Drop but this should be enough to go and play with now!</p>
<p>As for me, I'll be updating the Drag and Drop demos on <a href="http://html5demos.com">HTML5demos.com</a> to see if I can add ARIA support and capture a screencast of it running.  Watch this space!</p>
<h2 id="further_reader">Further Reader</h2>
<ul>
<li><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#dnd">HTML5 Drag and Drop spec</a></li>
<li><a href="http://html5demos.com/drag">Alternative demo</a></li>
<li><a href="http://html5demos.com/drag-anything">Demo showing different content types in drag and drop</a></li>
<li><a href="http://www.whatwg.org/demos/2008-sept/dnd/dnd.html">Inline event handles</a></li>
<li><a href="http://dev.opera.com/articles/view/accessible-drag-and-drop/">Accessible Drag and Drop</a></li>
</ul>
<div id="crp_related">
<h3>Related Posts:</h3>
<ul>
<li><a href="http://html5doctor.com/accessibility-native-drag-and-drop/" rel="bookmark" class="crp_title">Accessibility &#038; Native Drag and Drop</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-9/" rel="bookmark" class="crp_title">Your Questions Answered 9</a></li>
<li><a href="http://html5doctor.com/designing-a-blog-with-html5/" rel="bookmark" class="crp_title">Designing a blog with html5</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-8/" rel="bookmark" class="crp_title">Your Questions Answered #8</a></li>
<li><a href="http://html5doctor.com/why-designers-should-care-about-html5/" rel="bookmark" class="crp_title">Why designers should care about HTML5</a></li>
</ul>
</div>
<p>Share and Save:</p>
<p>	<a rel="nofollow"  href="http://twitter.com/home?status=Native%20Drag%20and%20Drop%20-%20http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;title=Native%20Drag%20and%20Drop&amp;bodytext=Along%20with%20an%20army%20of%20JavaScript%20APIs%2C%20HTML%205%20comes%20with%20a%20Drag%20and%20Drop%20%28DnD%29%20API%20that%20brings%20native%20DnD%20support%20to%20the%20browser%20making%20it%20much%20easier%20to%20code%20up.%20%20%0D%0A%0D%0AHTML%205%20DnD%20is%20based%20on%20Microsoft%26%238217%3Bs%20original%20implementation%20which%20was%20availab" title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;title=Native%20Drag%20and%20Drop" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;title=Native%20Drag%20and%20Drop&amp;notes=Along%20with%20an%20army%20of%20JavaScript%20APIs%2C%20HTML%205%20comes%20with%20a%20Drag%20and%20Drop%20%28DnD%29%20API%20that%20brings%20native%20DnD%20support%20to%20the%20browser%20making%20it%20much%20easier%20to%20code%20up.%20%20%0D%0A%0D%0AHTML%205%20DnD%20is%20based%20on%20Microsoft%26%238217%3Bs%20original%20implementation%20which%20was%20availab" title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;title=Native%20Drag%20and%20Drop" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Native%20Drag%20and%20Drop&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;t=Native%20Drag%20and%20Drop" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;title=Native%20Drag%20and%20Drop&amp;annotation=Along%20with%20an%20army%20of%20JavaScript%20APIs%2C%20HTML%205%20comes%20with%20a%20Drag%20and%20Drop%20%28DnD%29%20API%20that%20brings%20native%20DnD%20support%20to%20the%20browser%20making%20it%20much%20easier%20to%20code%20up.%20%20%0D%0A%0D%0AHTML%205%20DnD%20is%20based%20on%20Microsoft%26%238217%3Bs%20original%20implementation%20which%20was%20availab" title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Native%20Drag%20and%20Drop&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;t=Native%20Drag%20and%20Drop" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;title=Native%20Drag%20and%20Drop&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=Along%20with%20an%20army%20of%20JavaScript%20APIs%2C%20HTML%205%20comes%20with%20a%20Drag%20and%20Drop%20%28DnD%29%20API%20that%20brings%20native%20DnD%20support%20to%20the%20browser%20making%20it%20much%20easier%20to%20code%20up.%20%20%0D%0A%0D%0AHTML%205%20DnD%20is%20based%20on%20Microsoft%26%238217%3Bs%20original%20implementation%20which%20was%20availab" title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;h=Native%20Drag%20and%20Drop" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fnative-drag-and-drop%2F&amp;t=Native%20Drag%20and%20Drop&amp;s=Along%20with%20an%20army%20of%20JavaScript%20APIs%2C%20HTML%205%20comes%20with%20a%20Drag%20and%20Drop%20%28DnD%29%20API%20that%20brings%20native%20DnD%20support%20to%20the%20browser%20making%20it%20much%20easier%20to%20code%20up.%20%20%0D%0A%0D%0AHTML%205%20DnD%20is%20based%20on%20Microsoft%26%238217%3Bs%20original%20implementation%20which%20was%20availab" title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
<p><a href="http://html5doctor.com/native-drag-and-drop/" rel="bookmark">Native Drag and Drop</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on July 9, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/native-drag-and-drop/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>How to get HTML5 working in IE and Firefox 2</title>
		<link>http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/</link>
		<comments>http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 08:05:45 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
				<category><![CDATA[Browser Compatibility]]></category>
		<category><![CDATA[Structure]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=134</guid>
		<description><![CDATA[
			
				
			
		HTML 5 may be the latest and greatest technology, but some browsers don&#8217;t have native support for the new semantic elements. Let&#8217;s momentarily forget about the really sexy functionality, like full control over the &#60;video&#62; element, and just focus on getting the elements rendered.

The problematic A-grade browsers include IE 8 and below, Firefox 2, and [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
			</a>
		</div><p><abbr>HTML</abbr> 5 may be the latest and greatest technology, but <em>some</em> browsers don&#8217;t have native support for the new semantic elements. Let&#8217;s momentarily forget about the really sexy functionality, like <a href="http://html5doctor.com/the-video-element/">full control over the <code>&lt;video&gt;</code> element</a>, and just focus on getting the elements rendered.</p>

<p>The problematic <a href="http://developer.yahoo.com/yui/articles/gbs/">A-grade browsers</a> include <abbr>IE</abbr> 8 and below, Firefox 2, and Camino 1 (these last two browsers both use the Gecko rendering engine, which is why they&#8217;re both affected).</p>

<p>Let&#8217;s start with Internet Explorer.</p>

<span id="more-134"></span>

<h2><abbr>IE</abbr> doesn&#8217;t believe in <abbr>HTML</abbr> 5 elements</h2>

<p>Quite simply, <abbr>IE</abbr> doesn&#8217;t even <em>see</em> <abbr>HTML</abbr> 5 elements, much less style them.</p>

<p>This is actually the same issue that we had before <abbr>HTML</abbr> 5, where the <code>&lt;abbr&gt;</code> element couldn&#8217;t be styled in <abbr>IE</abbr> 6, resulting in <a href="http://www.sovavsiti.cz/css/abbr.html">all manner</a> of <a href="http://dean.edwards.name/my/abbr-cadabra.html">workarounds</a>. (Let me add that we&#8217;ll also fix the <code>&lt;abbr&gt;</code> element while we convince <abbr>IE</abbr> to recognise <abbr>HTML</abbr> 5 elements).</p>

<h3>The fix</h3>

<p>There is hope! The trick, discovered by <a href="http://intertwingly.net/blog/2008/01/22/Best-Standards-Support#c1201006277">Sjoerd Visscher</a>, is simply to create the new element using JavaScript, and <em lang="fr">voilà</em>, <abbr>IE</abbr> is able to style it:</p>

<pre><code>document.createElement('header');</code></pre>

<p>John Resig has also written about this <a href="http://ejohn.org/blog/html5-shiv/"><abbr>HTML</abbr> 5 shiv</a>.</p>

<p>For example, say you wanted to style the <code>&lt;time&gt;</code> element in italics:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Header test&lt;/title&gt;
  &lt;style&gt;
  time { font-style: italic; }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;time datetime=&quot;2009-09-13&quot;&gt;my birthday&lt;/time&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>

<p>This screenshot shows the rendering in <abbr>IE</abbr> <a href="http://jsbin.com/urawa">before</a> we apply the fix:</p>

<p><img class="alignnone size-full wp-image-143" title="IE without HTML 5 shiv" src="http://html5doctor.com/wp-content/uploads/2009/06/ie-without.png" alt="IE without HTML 5 shiv" width="570" height="337" /></p>

<p>To apply the fix, add the indicated line of code:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Header test&lt;/title&gt;
  &lt;style&gt;
  time { font-style: italic; }
  &lt;/style&gt;
  
  &lt;!-- Add this line --&gt;
  &lt;script&gt;document.createElement('time');&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;time datetime=&quot;2009-09-13&quot;&gt;my birthday&lt;/time&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>

<p>Now <a href="http://jsbin.com/iduto">after</a> we&#8217;ve applied the fix, it&#8217;s correctly styled in <abbr>IE</abbr>:</p>

<p><img class="alignnone size-full wp-image-142" title="IE with HTML 5 shiv" src="http://html5doctor.com/wp-content/uploads/2009/06/ie-with.png" alt="IE with HTML 5 shiv" width="565" height="327" /></p>

<h3>One hit solution</h3>

<p>For everyone&#8217;s convenience, I wrote a single JavaScript file that can be included to create all the <abbr>HTML</abbr> 5 elements (and the <code>&lt;abbr&gt;</code> element) for <abbr>IE</abbr>.</p>

<p><a href="http://remysharp.com/downloads/html5.js">Download the <abbr>IE</abbr> <abbr>HTML</abbr> 5 enabling script</a></p>

<p>Include the script in your <code>&lt;head&gt;</code> tag, and you&#8217;ll be able to style the elements appropriately in <abbr>IE</abbr>:</p>

<pre><code>&lt;!--[if lte IE 8]&gt;
&lt;script src=&quot;html5.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;![endif]--&gt;</code></pre>

<p>Note that I&#8217;ve used a conditional comment to only apply this to <abbr>IE</abbr> 8 and below. It&#8217;s my hope that <abbr>IE</abbr> 9 and onwards will support <abbr>HTML</abbr> 5 elements, but when that day comes, make sure to double check the conditional!</p>

<h3>Conditions &amp; Gotchas</h3>

<p>There are a couple of things to be aware of when using the HTML 5 shiv.</p>

<h4>JavaScript required</h4>

<p>This obviously means that your design now depends on JavaScript. Personally, I feel that if you&#8217;ve used semantic markup for your site and the elements can&#8217;t be styled, the content is still completely readable.</p>

<p>Here&#8217;s a screenshot of the <a href="http://2009.full-frontal.org/">Full Frontal</a> web site, written using <abbr>HTML</abbr> 5 elements, rendered in <abbr>IE</abbr> with and without JavaScript enabled:</p>

<p><img class="alignnone size-full wp-image-141" title="IE with and without JavaScript to fix HTML 5" src="http://html5doctor.com/wp-content/uploads/2009/06/ie-js-fix-compare.png" alt="IE with and without JavaScript to fix HTML 5" width="600" height="304" /></p>

<p>You can see in the second screenshot that the content isn&#8217;t perfect, but it&#8217;s still readable &mdash; it cascades down correctly, much as if <abbr>CSS</abbr> were disabled.</p>

<h4 id="a-little-head">A little head is always good</h4>

<p>If you create the new element and <em>don&#8217;t</em> use a <code>&lt;body&gt;</code> tag (which is perfectly valid <abbr>HTML</abbr> 5), <abbr>IE</abbr> will put all those created elements inside the <code>&lt;head&gt;</code> tag. Pretty crazy, but you can easily avoid this by always using both the <code>&lt;head&gt;</code> and <code>&lt;body&gt;</code> tags in your markup. <a href="http://blog.whatwg.org/supporting-new-elements-in-ie#comment-40743">Leif Halvard explains further with demos.</a></p>

<h2>Firefox 2 and Camino 1 rendering bug</h2>

<p>Both Firefox 2 and Camino 1 have a bug in the Gecko rendering engine (specifically versions prior to 1.9b5):</p>

<blockquote><p>Firefox 2 (or any other Gecko-based browser with a Gecko version pre 1.9b5) has a parsing bug where it will close an unknown element when it sees the start tag of a &#8220;block&#8221; element p, h1, div, and so forth.</p></blockquote>

<p>According to the <a href="http://www.w3schools.com/browsers/browsers_firefox.asp">W3 Schools stats</a>, Firefox 2 only has around 3% of the market &mdash; perhaps low enough to justify ignoring it. It&#8217;s safe to assume that Camino 1 commands an even smaller percentage of the market.</p>

<p>By ignoring this issue, however, a site can look quite bad in these browsers. So how can we fix it?</p>

<p>The bug surfaces when Gecko doesn&#8217;t recognise an element. Explained roughly, when Gecko parses an unrecognised element, it removes the element&#8217;s contents and puts them next to the element.</p>

<p>Take, for example, the following code:</p>

<pre><code>&lt;body&gt;
  &lt;header&gt;&lt;h1&gt;Title&lt;/h1&gt;&lt;/header&gt;
  &lt;article&gt;&lt;p&gt;...&lt;/p&gt;&lt;/article&gt;
&lt;/body&gt;</pre></code>

<p>This will be parsed in Gecko (prior to version 1.9b5) as if the markup were actually as follows:</p>

<pre><code>&lt;body&gt;
  &lt;header&gt;&lt;/header&gt;
  &lt;h1&gt;Title&lt;/h1&gt;
  &lt;article&gt;&lt;/article&gt;
  &lt;p&gt;...&lt;/p&gt;
&lt;/body&gt;</code></pre>

<p>The visual result is similar to the above screenshot of <abbr>IE</abbr> running without JavaScript (though subtly different, as the DOM tree is actually in a different order than you as the author intended).</p>

<h3>The fix</h3>

<p>There are two approaches to fixing this issue, and so far I've only successfully used the non-JavaScript approach.</p>

<h4>The JavaScript solution</h4>

<p>The first approach is to use JavaScript to traverse the DOM tree, rearranging elements as issues are encountered. Simon Pieters has a <a href="http://blog.whatwg.org/supporting-new-elements-in-firefox-2">small working example</a> of how this can be done (towards the bottom of the page). In practise, however, I <em>personally</em> found it didn't work for my markup. The problem is definitely solvable using JavaScript, but this solution still needs work to handle all permutations of markup.</p>

<h4>The <abbr>XHTML</abbr> solution</h4>

<p>The second approach is to serve Gecko XHTML. I've found this to be the easier approach if you're either generating a page dynamically (using something like PHP) or if you can create your own <code>.htaccess</code> file to use Apache's <code>mod_rewrite</code>.</p>

<p>The first change to your markup is to add the <code>xmlns</code> attribute to your <code>&lt;html&gt;</code> tag:</p>

<pre><code>&lt;html lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;</code></pre>

<p>Next, we need to sniff the user agent string (typically a bad approach, but justifiable when targeting such a specific group of users). If the Gecko build is less than 1.9, then we need to set the Content-type header to <code>application/xhtml+xml</code>.</p>

<p>If you want to use <code>mod_rewrite</code> in an <code>.htaccess</code> file (or the <code>httpd.conf</code> file), you need the following rules:</p>

<pre><code>RewriteCond %{REQUEST_URI} \.html$
RewriteCond %{HTTP_USER_AGENT} rv:1\.(([1-8]|9pre|9a|9b[0-4])\.[0-9.]+).*Gecko
RewriteRule .* - [T=application/xhtml+xml]</code></pre>

<p>This rule sends the proper Content-type header to all Gecko based browsers where version is less than 1.9, or "rv:1.9pre" or "rv:1.9a" or "rv:1.9b<em>x</em>" where <em>x</em> is less than 5.</p>

<p>If you don't want to use the <code>mod_rewrite</code> approach, you'll need to manually send the header in your server side scripts. Here's a solution for a PHP script:</p>

<pre><code>if (preg_match('/rv:1\.(([1-8]|9pre|9a|9b[0-4])\.[0-9.]+).*Gecko/', $_SERVER['HTTP_USER_AGENT'])) {
  header('Content-type: application/xhtml+xml');
}</code></pre>

<p>This snippet needs to be included <em>before</em> anything has been printed by your script &mdash; i.e., as early as possible.</p>

<h3>Gotcha: Yellow Screen of Death</h3>

<p>The Yellow Screen of Death shows up whenever there's an <abbr>XML</abbr> error on the page. If we're serving markup as <abbr>XML</abbr> and telling the browser to interpret it strictly as <abbr>XML</abbr>, then we can't serve any characters it doesn't recognise or else it's going to bork:</p>

<p><img src="http://upload.wikimedia.org/wikipedia/commons/4/48/Yellow_screen_of_death.png" alt="Yellow Screen of Death" /></p>

<p>Below are a few ways to avoid <abbr>XML</abbr> parsing errors.</p>

<h4>Create strict markup</h4>

<p>You need to ensure your markup is squeaky clean &mdash; but that's easy, because you're already a Markup Jedi, right?</p>

<h4>Use <abbr>XML</abbr> entities</h4>

<p><abbr>HTML</abbr> entities are a no-no. Sorry, but <code>&amp;bull;</code> isn't going to fly anymore. You need to use <abbr>XML</abbr> entities, the numerical representation of these characters.</p>

<p>I've built <a href="http://leftlogic.com/lounge/articles/entity-lookup/">an entity lookup tool</a> that shows the <abbr>HTML</abbr> entity and the <abbr>XML</abbr> value of that entity. For example, <code>&amp;bull;</code> is 8226, so the XML entity is <code>&amp;#8226;</code>.</p>

<h4>Sanitise user generated content</h4>

<p>If your site relies on any user generated content (e.g., blog comments), then you need to sanitise the output to ensure there are no validation issues to trigger the Yellow Screen of Death.</p>

<p>This issue alone may justify further investigation of a JavaScript solution.</p>

<h3>Worth the trouble?</h3>

<p>All that said, Firefox has a very good automated upgrade path. Looking at the <a href="http://www.w3schools.com/browsers/browsers_firefox.asp">stats on W3Schools</a>, it's safe to say that the number of users with this Gecko bug is rapidly diminishing.</p>

<h2>Further reading</h2>

<ul>
<li><a href="http://blog.whatwg.org/supporting-new-elements-in-firefox-2">Firefox 2 rendering issue on WHATWG Blog</a></li>
<li><a href="http://blog.whatwg.org/supporting-new-elements-in-ie#comment-40743"><abbr>IE</abbr> / missing head tag issue</a></li>
<li><a href="http://ejohn.org/blog/html5-shiv/"><abbr>HTML</abbr> 5 shiv</a></li>
<li><a href="http://remysharp.com/2009/01/07/html5-enabling-script/"><abbr>HTML</abbr> 5 enabling script</a></li>
</ul>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/html-5-boilerplates/" rel="bookmark" class="crp_title">HTML5 Boilerplates</a></li><li><a href="http://html5doctor.com/legend-not-such-a-legend-anymore/" rel="bookmark" class="crp_title">Legend not such a legend anymore</a></li><li><a href="http://html5doctor.com/dd-details-wrong-again/" rel="bookmark" class="crp_title">dd-details wrong again</a></li><li><a href="http://html5doctor.com/native-drag-and-drop/" rel="bookmark" class="crp_title">Native Drag and Drop</a></li><li><a href="http://html5doctor.com/designing-a-blog-with-html5/" rel="bookmark" class="crp_title">Designing a blog with html5</a></li></ul></div>


Share and Save:


	<a rel="nofollow"  href="http://twitter.com/home?status=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202%20-%20http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;title=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202&amp;bodytext=HTML%205%20may%20be%20the%20latest%20and%20greatest%20technology%2C%20but%20some%20browsers%20don%27t%20have%20native%20support%20for%20the%20new%20semantic%20elements.%20Let%27s%20momentarily%20forget%20about%20the%20really%20sexy%20functionality%2C%20like%20full%20control%20over%20the%20%26lt%3Bvideo%26gt%3B%20element%2C%20and%20just%20focu" title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;title=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;title=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202&amp;notes=HTML%205%20may%20be%20the%20latest%20and%20greatest%20technology%2C%20but%20some%20browsers%20don%27t%20have%20native%20support%20for%20the%20new%20semantic%20elements.%20Let%27s%20momentarily%20forget%20about%20the%20really%20sexy%20functionality%2C%20like%20full%20control%20over%20the%20%26lt%3Bvideo%26gt%3B%20element%2C%20and%20just%20focu" title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;title=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;t=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;title=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202&amp;annotation=HTML%205%20may%20be%20the%20latest%20and%20greatest%20technology%2C%20but%20some%20browsers%20don%27t%20have%20native%20support%20for%20the%20new%20semantic%20elements.%20Let%27s%20momentarily%20forget%20about%20the%20really%20sexy%20functionality%2C%20like%20full%20control%20over%20the%20%26lt%3Bvideo%26gt%3B%20element%2C%20and%20just%20focu" title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;t=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;title=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=HTML%205%20may%20be%20the%20latest%20and%20greatest%20technology%2C%20but%20some%20browsers%20don%27t%20have%20native%20support%20for%20the%20new%20semantic%20elements.%20Let%27s%20momentarily%20forget%20about%20the%20really%20sexy%20functionality%2C%20like%20full%20control%20over%20the%20%26lt%3Bvideo%26gt%3B%20element%2C%20and%20just%20focu" title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;h=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fhow-to-get-html5-working-in-ie-and-firefox-2%2F&amp;t=How%20to%20get%20HTML5%20working%20in%20IE%20and%20Firefox%202&amp;s=HTML%205%20may%20be%20the%20latest%20and%20greatest%20technology%2C%20but%20some%20browsers%20don%27t%20have%20native%20support%20for%20the%20new%20semantic%20elements.%20Let%27s%20momentarily%20forget%20about%20the%20really%20sexy%20functionality%2C%20like%20full%20control%20over%20the%20%26lt%3Bvideo%26gt%3B%20element%2C%20and%20just%20focu" title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/><p><a href="http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/" rel="bookmark">How to get HTML5 working in IE and Firefox 2</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on June 20, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/feed/</wfw:commentRss>
		<slash:comments>95</slash:comments>
		</item>
	</channel>
</rss>
