Beware of XHTML

This one is the current industry buzz. Basically, a slam against XHTML and a suggestion to return to HTML 4.01 in lieu of using XHTML 1.0 (or 1.1).

You know I can’t let this go without a comment … or three. 😉

Okay, so first the basics: the W3C effectively ended HTML standards development in December 1999 with the release of HTML 4.01. XHTML 1.0, a “reformulation of HTML 4 in XML 1.0” was released barely a month later. XHTML was deemed to be “better” because of its basis in XML, and the belief that XML would be the future for browsers.

Back then, it made sense. A lot of HTML was horribly abused, giving rise to such abhorrences such as the bold, italics, and font tags, and the use of HTML tables for layout. It was believed that a shift to a more “standards-complaint” tag language (in combination with better CSS use) would bring an end to all that was evil.

But.

One problem: XHTML, ideally-speaking, is an XML application. Therefore, it needs XML-based programs to process it properly. None of the bigger browsers do. Most of the major browser developers even suggest:

If we tried to support real XHTML in IE 7 we would have ended up using our existing HTML parser (which is focused on compatibility) and hacking in XML constructs. It is highly unlikely we could support XHTML well in this way.

Microsoft (Internet Explorer)

If you are using the usual HTML features […] serving valid HTML 4.01 as text/html ensures the widest browser and search engine support.

Mozilla (Firefox)

On today’s web, the best thing to do is to make your document HTML4 all the way. Full XHTML processing is not an option, so the best choice is to stick consistently with HTML4.

Apple (Safari)

I don’t think XHTML is a realistic option for the masses. HTML5 is it.

HÃ¥kon Wium Lie (from Opera, W3C)

I’m an advocate of using XHTML only in the correct way, which basically means you have to use HTML. Period.

Anne van Kesteren (from Opera)

Authors intending their work for public consumption should stick to HTML 4.01.

Ian Hickson (from Opera, Google, W3C)

I’m a little torn, to say the least. Yes, it’s true to say that XHTML never got the the lofted position it could have reached. Because no-one developed for it. All the Web Developers rushed to it for the standards-compliance and the XML-like coding methodology. But there’s no support for what it truly could do.

The article goes on at length pointing out all the major issues:

  • XHTML does not point out anything new for structure, separation of content and presentation, proper tag use, etc. than HTML already provided
  • XHTML as a standard is not actually well-supported, nor is it any faster than HTML
  • The “strength” of failing on invalid markup is a benefit from XML, but that valid markup doesn’t mean it’s well-formed
  • When XHTML is served as text/html instead of application/xhtml+xml, there is no benefit (really) to using HTML
  • Internet Explorer doesn’t support XHTML at all

So where does this leave us? Do we all abandon XHTML and retreat to HTML 4.01? (Despite HÃ¥kon suggesting that HTML 5 is on the way, we’re a very long way from that being a reality in the majority of browsers. You could also go conspiracist and suggest that this is just a ploy to get people to sign on with the WHAT-WG and their new Web Applications 1.0 working draft, conveniently released today.)

Tim Berners-Lee must be spinning in his grave. Well, if he were dead. Which he isn’t.

I think it depends how you use XHTML. You can’t use it as the specification says you should. But can you use the principles in coding practices to at least achieve a consistent and reliable use in development practices? We do.

In fact, until someone mentioned the proper use to me a couple of years ago, I’d never even paused to really consider that aspect of XHTML. For me, it was all about working through standards and making them work better for us. Something we achieved.

Frankly, I don’t want to roll back to HTML 4.01. Too many negative connotations for me. I’ll continue to use “XHTML” to help ensure better code consistency. When XHTML 2 or HTML 5 actually roll out a door and are properly supported in a browser, then I’ll move.

I imagine that’ll be the day when when pigs fly, the cow jumps over the moon, or we discover the lost city of Atlantis. Frankly, I think they’ve got as much a chance of happening as proper and complete adoption of a new/better HTML standard.

Leave a Reply

Your email address will not be published. Required fields are marked *