HTML5 – it's the little things

Much has been written about the major benefits of HTML5, but there are some overlooked details I really appreciate as well.

Prior to switching to HTML5, I used XHTML 1.0 Transitional for over a decade. I liked the XML-derived syntax, which encouraged rigorous coding standards. You could test your pages against the W3C standards using an online validator, a valuable first step in the time-consuming browser testing process. Why waste time addressing browser bugs if your code has errors to begin with?

XHTML 1.0 Strict: too rigorous?

This led me to investigate XHTML 1.0 Strict, which seemed to take the “rigour” concept to its natural conclusion. But I couldn’t get along with some of its restrictions. In particular, the “start” attribute of the <ol> tag was now illegal. This was a terrible idea. Here’s why.

Let’s say you have a regular numbered list and, for some reason, you have to break it into sections. So your first section has four elements, you need to omit the fifth and sixth, and you restart with the seventh. Your rendered code looks like this:

These are the available options. Items five and six have been omitted as they are incompatible with this product:

  1. List Item 1
  2. List Item 2
  3. List Item 3
  4. List Item 4
  1. List Item 5
  2. List Item 6

With 1.0 Transitional, you create a new <ol> after the fourth item, with a start attribute with the value 7. With 1.0 Strict, the start attribute is illegal, so the only way you can do this is with CSS. In other words, your HTML remains an ordered list numbered 1 through 6, and you rely on CSS – your presentation layer – to handle the change in numbering.

Keeping style and content separate

What happened to the separation of presentation and content? This approach relies on a styling mechanism to convey the meaning of your document. But the meaning of your document should never depend on the availability of a styling mechanism. Imagine, for a moment, a sight-impaired user discussing medication instructions with a pharmacist over the phone, while referring to a non-contiguous list of this kind. It’s easy to foresee how misunderstandings, possibly dangerous, could arise in this situation.

Strict means strict

It seems extreme to reject a protocol for one seeming error, even an egregious one. But Strict means strict. If you can’t fully adhere to a strict protocol, then you must find either a protocol you can adhere to, or one that’s innately forgiving.

HTML5: as strict as you need

This is all water under the bridge, of course. HTML5 is very forgiving, while allowing you to be as strict as you please. It has no problem with non-contiguous lists. So while much has rightly been said about the major advances of HTML5 – not least the new, semantic tags, improved form handling, better audio and video support – the greater coding flexibility is a fundamental improvement, whether or not any of these new features are used.

Despite HTML5's forgiving nature – the validator is still your friend.

Posted in: