Modern Software Experience

2008-01-22

HTML 5

joint standard

W3C

The World Wide Web Consortium (W3C) HTML Working Group has released the first working draft of HTML 5.

WHATWG

There already was an HTML 5 specification, created by WHATWG. Although that effort was started with standardisation and compatibility in mind, worries arose when the W3C responded with the creation of a new HTML Working Group last year.

W3C & WHATWG

The W3C and WHATWG have been cooperating on this specification, and are now jointly publishing it.

differences

Tip: The WHATWG page not only includes Adobe PDF versions in both A4 and letter format, but links to a FAQ too. The W3C has a document that provides an overview of the differences between HTML 4 and HTML 5. A quick breeze through that document reveals a few interesting things.

backward compatibility

HTML features that were deprecated in earlier specifications are not valid HTML 5. Many are not even documented anymore. To be more precise, they are not document as HTML you can write, but in support of backward compatibility, they are documented as HTML that browser must handle.

authors and users agents

The specification distinguishes between HTML authoring and HTML rendering, the specification for HTML authors and users agents (browsers) are not the same. The differences document describes the elements that should not be used but still supported by browser in Absent Elements and Absent Attributes sections.

not finished

Another interesting deviation from past practice is that the HTML 5 spec will not be finished until there are two working implementations. This ensures that it is both implementable and immediately usable the moment the spec becomes an official recommendation.

HTML and XHTML

The HTML 5 is specification is for both HTML and XHTML. The two mark-up languages it defines are known as HTML 5 and XHTML 5. This is a possibly confusing state of affairs, and it would be better to rename the specification to (X)HTML 5.

tag soup and strict

The (X)HTML 5 spec supports both an HTML (tag soup) and an XHTML (strict) syntax. For the HTML syntax, HTML 5 requires a doctype declaration to ensure the browser will render the page in standards mode. XHTML pages should always be rendered in standards mode.

tag soup

Reading through the specification, you may get the impression that HTML 5 (not XHTML 5, only HTML 5) legitimises tag soup. The HTML 5 does not endorse, promote or legitimise tag soup in any way. The HTML 5 specification merely specifies tag soup handling for user agents, to ensure consistent handling of tag soup by different browsers.

style 

The HTML 5 specification is clear that you should be using Cascading Style Sheets (CSS) for layout. Layout elements and attributes that were deprecated already are gone now, making CSS the only way to control layout.

frames-free

HTML 5 is frames-free, just like XHTML 1.1. The W3C deprecated frames already, because of their usability and accessibility issues. In HTML 5, frames are gone. This is a good thing, as many web developers seemed unwilling to learn accessible web design techniques, and kept using frames for new web sites. This change will force them upgrade their skills.

doctype

The doctype declaration for HTML 5 is considerably simpler than that used in earlier version of HTML and XHTML, and many browsers already support it: <!doctype html>.

MIME type

The MIME type for HTML 5 must be text/html. The MIME for XHTML 5 must be an XML MIME type, and it may not be text/html. If you are already using application/xhtml+xml for XHTML 1.1 (like this page), you are doing fine.

<acronym> vs. <abbr>

The confusion between <acronym> and <abbr> is no more. HTML 5 supports <abbr> only.

new elements

There are new HTML elements. The <nav>, <header>, <footer>, <section>, <article>, <dialog> and <aside> tags have been introduced to provide more structure.

The <figure> tag solves a long-standing complaint by providing a single tag that encompasses both some content and a legend - think photo plus description. The <audio> and <video> take make including multimedia easier.

more

There are many more new elements and tags. The differences document mentions them all, no sense repeating that here. One addition that caught my eye is the support for date and time in both input and output. HTML 5 provides explicit support for date and time in a way that lets the user agent decide on the representation, and allow browsers to present a date-picker.

Some new elements that will make it easy to create rich user interfaces are <datagrid>, <datalist>, <command> and <event-source>. Some other interesting new tags are <canvas> for drawing dynamic content on, <progress> for displaying progress bars, and <m> to indicate a run of marked text.

new attributes

HTML 5 introduces new attributes. One you may already have seen mentioned is the ping attribute. This attribute provides a script-free way of tracking which links a user clicks. It also lessens server load, and gives the user-agent full control over this feature. A browser could indicate the presence of a ping attribute and allow privacy-conscious user control over this feature.

A few things have slightly changed semantics. These changes are hardly changes, but mostly bring the specification in line with actual usage. Remarkable is that a few attributes that were deprecated already are no longer deprecated in HTML 5.

Quite a few of the new attributes are in support of a richer web forms that provide a better user interface experience. There is even support for context-menus and drag & drop in there.

APIs

HTML 5 introduces a variety of new Application Programming Interfaces (APIs) such as 2D drawing API to be used with the canvas element, a drag & drop API, a network API and persistent storage, to name just a few. Persistent storage is a biggy.

DOM

HTML 5 introduces a few extensions to the Document Object Model (DOM).

status

support

Although it is still a moving target, several browsers already offer varying levels of support for HTML 5. The HTML 5 doctype declaration and the canvas element are already widely supported.

validator 

The W3C HTML validator does not support the HTML 5 draft recommendation yet. There is no HTML 5 DTD you can use with existing validators. The WHATWG has an experimental HTML 5 validator.

links

W3C

WHATWG