Dive into HTML5

Sunday 28 March 2010

Mark Pilgrim is good at writing introductions to technical topics, and his latest is no exception: Dive Into HTML5. It's a detailed exposition of the latest additions to HTML.

Some of it seems strangely circuitous, as in the first chapter when he recounts in detail how the img tag got added to HTML in the first place. He has a reason (which is to underscore that HTML was never pure in the first place), but it can seem a long way to go for the lesson.

I've added a few simple tweaks to this site as a result of perusing the changes: input fields of type email and url, and links with rel of author, tag, and license. I haven't gotten into the deeper changes like the new semantic tags <article>, <header> and <time>. Native video is even farther out.

I also learned about OpenSearch which doesn't seem worth it for this site. I can't imagine many people want a special search just for this blog.

And I also learned something new about Internet Explorer in my tangential browsing along the way also: not only does IE interpret these odd conditional HTML comments:

<!--[if IE 6]>
    Special instructions for IE 6 here
<![endif]-->

but it also has a Javascript conditional comment syntax:

/*@cc_on
    alert("Hello IE user (please, please switch)!");
@*/

This leads to this remarkably terse snippet to detect if your code is running in IE:

var ie = /*@cc_on!@*/false;

Will the wonders never cease?

Comments

[gravatar]
Edward O'Connor 1:59 PM on 28 Mar 2010

Here's an equivalent test that is even more terse (and more evil):

var ie = !+[1,];

[gravatar]
Danny Navarro 9:56 AM on 29 Mar 2010

You can get lots of OpenSearch examples at mycroft project. http://mycroft.mozdev.org/

You even have a form to autogenereate OpenSearch examples.

I'm trying to avoid googling for everything and instead use OpenSearch directly for the sites I search most frequently: Python docs, wikipedia, arch wiki, google maps, google translator, etc...

Add a comment:

name
email
Ignore this:
not displayed and no spam.
Leave this empty:
www
not searched.
 
Name and either email or www are required.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.