<?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>Paul Hayes &#187; html5</title>
	<atom:link href="http://www.paulrhayes.com/tag/html5/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paulrhayes.com</link>
	<description>The web musings and experiments of.</description>
	<lastBuildDate>Sun, 06 Nov 2011 11:31:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CSS Modal follow up</title>
		<link>http://www.paulrhayes.com/2011-04/css-modal-follow-up/</link>
		<comments>http://www.paulrhayes.com/2011-04/css-modal-follow-up/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 21:43:51 +0000</pubDate>
		<dc:creator>Paul Hayes</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[transformations]]></category>

		<guid isPermaLink="false">http://www.paulrhayes.com/?p=141</guid>
		<description><![CDATA[A cross browser modal box with CSS animations. Supported in IE7+ it's now being used to add comments.]]></description>
			<content:encoded><![CDATA[<p>In <a href="/2011-03/css-modal/">my original post</a> I explained how to create a CSS only modal pop-up using :target, pseudo-elements and pointer events. This had a number of caveats, any browser that didn’t support pointer events would see a non-clickable page and the forward/back controls would navigate through dialogues, which is usually undesirable. Of course it was only an experiment.</p>
<p>My comment form had been much neglected and it felt like the perfect opportunity to try out this modal in a real environment. Click the “<a href="#respond" class="respond">Post a comment</a>” link to see it in action.</p>
<p><iframe class="vimeo" src="http://player.vimeo.com/video/22774103" width="612" height="408" frameborder="0"></iframe></p>
<p>All references to the :target pseudo-selector have been removed, instead an “active” class is toggled using JavaScript. The CSS modal still uses an opacity transition but pointer events are gone. The default is now display:none with an intermediate state that renders the modal as display:block (remember it still begins at opacity: 0).</p>
<p>The flow is:</p>
<ul>
<li>Add an intermediate class to trigger the modal elements above everything, with opacity 0.</li>
<li>Add an active class to trigger animation and transition to full opacity.</li>
<li>On close, remove active class, add minimise class to trigger  minimise animation and transition to opacity 0.</li>
<li>Remove intermediate class.</li>
</ul>
<p>Onclick handlers are added to the “post comment” links to add classes and to the close link to remove them. When opened a handler is added to the body to listen for the ESC key, which closes the modal. The first input in the modal is focused on open.</p>
<p>I took the opportunity to play with some HTML5 features. The comment form now uses placeholder attributes, and if supported, labels are hidden. The feature detection is delightfully simple:</p>
<pre>
supportPlaceholder: function() {
	  var i = document.createElement('input');
	  return 'placeholder' in i;
}()
</pre>
<p>See <a href="http://diveintohtml5.org/detect.html#input-placeholder">Dive into HTML5</a> for more.</p>
<p>The close link text which has an :after pseudo-element (i.e. the X) is no longer hidden, instead it becomes the cancel link and is essential for browsers that can’t comprehend generated content.</p>
<p>In webkit you’ll see the modal bounce in and minimise out (smoothly in Safari and iOS). In Firefox you’ll get an opacity transition and in IE the modal will just appear or disappear. In IE8 and below the page is not greyed out due to lack of rgba support. I’m fine with this. This is still a bit of a trial to see how people actually use the modal and what problems it might throw up.</p>
<p>In conclusion, with JavaScript much of the mechanical new CSS can be dropped and with a slightly more complicated class toggle system we achieve cross browser support, without sacrificing that lovely hardware accelerated CSS animation.</p>
<p>Still want that animation cross browser? I recommend looking into <a href="http://farukat.es/journal/2011/02/514-new-creation-jquery-runloop-plugin">Faruk Ateş’s Runloop jQuery plugin</a> which gives you keyframed animations in any browser.</p>
<p>In other news, I’ve tidied up the comments layout a little and added a short <a href="/category/bookshelf/">books category</a> with a selection of books I highly recommend.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulrhayes.com/2011-04/css-modal-follow-up/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Moving markup towards HTML5</title>
		<link>http://www.paulrhayes.com/2009-06/moving-markup-towards-html5/</link>
		<comments>http://www.paulrhayes.com/2009-06/moving-markup-towards-html5/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 23:03:31 +0000</pubDate>
		<dc:creator>Paul Hayes</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.fofronline.com/?p=78</guid>
		<description><![CDATA[A foray into marking up a blog with HTML5]]></description>
			<content:encoded><![CDATA[<p>Having read John Resig’s “<a href="http://ejohn.org/blog/html5-shiv/">HTML5 Shiv</a>” article and Remy Sharp’s “<a href="http://remysharp.com/2009/01/07/html5-enabling-script/">HTML5 enabling script</a>”, it felt like the right time to begin the full fledged migration from XHTML to a cross browser compatible HTML5 blog. All in all the process of updating the templates was painless, taking about an hour or so to modify the WordPress Sandbox theme.<br />
<span id="more-78"></span></p>
<p>To enable IE6 and IE7 support for new HTML5 tags, which are not naturally styled, some JavaScript is necessary. As per the ‘shiv’ article, Remy Sharp has a small script that creates DOM elements, one for each type of new HTML5 tag, the simple act of doing so leads Internet Explorer to apply styles to said tags. I slightly modified the existing script to add the recently proposed <code>hgroup</code>.</p>
<p>Even though these tags accept style they don’t come with their default renderings. For that we need a bit of CSS to make block elements behave as they should.</p>
<pre class='prettyprint'>
(function(){
	if(!/*@cc_on!@*/0) return;
	var e = &quot;abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,
		eventsource,figure,footer,hgroup,header,mark,menu,meter,nav,output,
		progress,section,time,video&quot;.split(','),i=0,length=e.length;
	while(i&lt;length){
		document.createElement(e[i++])
	}
})();
</pre>
<pre class='prettyprint'>
article, aside, dialog, footer, header, section, footer, nav, figure {
	display: block;
}
</pre>
<p>I’ve also updated the Eric Meyer reset script, removing now deprecated HTML 4 tags and applying reset to the new elements, so they do not unexpectedly inherit padding, margin, etc. in the future. These changes are not yet exhaustive.</p>
<p>Moving onto the page’s actual markup, the new DOCTYPE and character encoding settings are remarkably simple. Standards based web development is getting easier. For browsers that do not support HTML5, the new DOCTYPE still triggers standards mode. The <code>xmlns</code> HTML attribute is no longer necessary and the <code>profile</code> attribute has been dropped.</p>
<pre class='prettyprint'>
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;
&lt;head&gt;
	&lt;meta charset=&quot;UTF-8&quot; /&gt;
	&lt;title&gt;FofR Online&lt;/title&gt;
</pre>
<p>The header section has been placed in the appropriate <code>&lt;header&gt;</code> tags, and similarly with the footer. I’d hoped to include the ‘About Me’ section within this, but as part of the specification you cannot include headings within a <code>&lt;footer&gt;</code> element.</p>
<p>Each of the posts comes wrapped in an <code>&lt;article&gt;</code> tag, i.e. an independent element with content that could standalone. Within are the respective <code>&lt;header&gt;</code> (containing title and date) and <code>&lt;footer&gt;</code> (containing meta links)  elements. Technically the meta links could be marked as <code>&lt;nav&gt;</code>, but the former is more fitting and still acceptable use.</p>
<p>The date makes use of HTML5’s <code>&lt;time&gt;</code> element, with a <code>datetime</code> attribute that gives the precise posting time, including timezone offset.</p>
<p>The previous and next links that follow the article can comfortably sit within a <code>&lt;nav&gt;</code> tag. Similarly, my sidebar region is predominantly navigation based with lists of archives and categories, it’s been marked as such.</p>
<pre class='prettyprint'>
&lt;article id=&quot;post-67&quot; class=&quot;&quot;&gt;
	&lt;header&gt;
		&lt;h2 class=&quot;entry-title&quot;&gt;&lt;a href=&quot;&quot; title=&quot;&quot; rel=&quot;bookmark&quot;&gt;POST TITLE&lt;/a&gt;&lt;/h2&gt;
		&lt;div class=&quot;entry-date&quot;&gt;
			&lt;time datetime=&quot;2009-04-30T15:54:28-07:00&quot; class=&quot;published&quot; title=&quot;2009-04-30T15:54:28-07:00&quot;&gt;April 30, 2009 &amp;#8211; 3:54 pm&lt;/time&gt;
		&lt;/div&gt;
	&lt;/header&gt;
	&lt;div class=&quot;entry-content&quot;&gt;
		POST
	&lt;/div&gt;
	&lt;footer class=&quot;entry-meta&quot;&gt;
		META LINKS
	&lt;/footer&gt;
&lt;/article&gt;

&lt;nav id=&quot;nav-below&quot; class=&quot;navigation clearfix&quot;&gt;
	&lt;div class=&quot;nav-previous&quot;&gt;&lt;/div&gt;
	&lt;div class=&quot;nav-next&quot;&gt;&lt;/div&gt;
&lt;/nav&gt;
</pre>
<p>One avenue I should explore is the inclusion of the <code>&lt;section&gt;</code> tag, which I’d like to break up individual posts, probably by splitting the content at level three headings downwards; thereby becoming the header of each new section.</p>
<p>It’ll be a while before the real benefits of HTML5 can be fully appreciated by everyone, but it feels good to make a start, however small that step may be.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulrhayes.com/2009-06/moving-markup-towards-html5/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

