06 March 2009

Why HTML validation matters

Anyway, we validated as the much saner HTML 4.01 strict, and even then I'm not sure it was worth the time we spent. So many of these validation rules feel arbitrary and meaningless. And, what's worse, some of them are actively harmful. For example, this is not allowed in HTML strict:

<a href="http://www.example.com/" target="_blank">foo</a>

That’s right, target, a perfectly harmless attribute for links that you want to open in a different browser tab/window, is somehow verboten in HTML 4.01 strict.

—Jeff Atwood, “HTML Validation: Does It Matter?


  1. The target attribute is harmful. The user should decide where a link opens.
  2. If you validate against the strict doctype, expect it to be strict. If you want to do rude things like use the target attribute, then HTML 4.01 strict is not for you.

But enough haranguing, on to the question at hand—assuming you’ve picked an appropriate doctype to validate against.

But the question remains: does HTML Validation really matter?

op. cit.

I validate my HTML to ensure that any errors in it’s use aren’t my fault.

Note, however, that this isn’t so that I can say, “It’s not my fault!” when something goes wrong. I may still tweak things to work around quirks in a particular browser or other program that may read that HTML. Rather it is to minimize the miscommunication.

People understand instinctively that the best way for computer programs to communicate with each other is for each of the them to be strict in what they emit, and liberal in what they accept. The odd thing is that people themselves are not willing to be strict in how they speak, and liberal in how they listen.

—Larry Wall, “2nd State of the Onion

No comments: