Hixie's Natural Log

2003-01-15 11:41 UTC And on the Eighth Day, He brought forth Progress. And it was good.

Several people have asked me what I think of XHTML2.

In the words of Jack O'Neill, it seems I am not receiving all my memos. Apparently, the popular position at the moment is to diss XHTML2. I'm not entirely sure when this became popular — I think it was last week sometime.

XHTML2 is a working draft, a work in progress, an incomplete specification with many recorded open issues. The XHTML working group, though, have been kindly keeping us apraised of their status by releasing a draft every 4 months or so. This is commendable, and as a member of the CSS working group, I know how hard that is to do. We (the CSS working group) sometimes let years pass between releasing drafts of our modules!

Personally, I think XHTML2 is shaping up to be a great specification.

Here are some of the highlights:

  1. Any element can be made into a link, not just the <a> element, simply by adding an href attribute.
  2. Any element can be marked with an edit attribute to indicate that it was inserted, deleted, changed or moved.
  3. Any element can have a cite attribute pointing to a URI from which the information contained in the element was obtained.
  4. The <section> and <h> elements make life a lot easier for those editing large documents or generating content on the fly: you no longer have to remember what nesting depth you're at for your headers.
  5. The lone <br/> element is finally upgraded to a fully fledged <l> ... </l> element, so that instead of marking the line break, you can actually mark the real content: the line itself.
  6. Paragraphs can now contain lists and tables as well as text, so that if your sentence contains a list, you don't need to lie in your markup and split your paragraph into two bits with a list between them.
  7. The <nl> element! At last, pages can have explicit markup for Navigation Lists. Instead of using deeply nested sets of <div> or <ol> elements, with lots of JavaScript to make them open and close, XHTML2 provides you with a simple element that lets you give a tree structure to your navigation links. Plus, using HTCs or XBL (or whatever binding and behaviour language the W3C have standardised by the time XHTML2 becomes widely used), you can change this behaviour without changing your markup.

There are also several more controversial features that I think are great, such as:

  1. It is an XML language, which means that all documents must be well formed or they simply won't render.
  2. It uses namespaces, meaning that it can be mixed with content from other W3C specifications such as MathML.
  3. Backwards compatiblility is explicitly not one of its design goals, so some of the hard changes that HTML has needed for some time are possible.
  4. Its design, by and large, meshes well with the styling capabilities of CSS and binding technologies like HTCs or XBL. This means it is easy to style, but also easy to implement.
  5. The style attribute is removed, which means that in XHTML2 authors are forced to think about separating style from content once and for all. And for those of you who still say you need the style attribute: I've gone over two years now without using it. I know this, because I set about, two years ago, to see if I could find a use case for the style attribute, and I never found one. If you disagree, drop me a line with your use case.

There are several commonly repeated myths about XHTML2:

<acronym> is gone
It was redundant with <abbr>, which is still present. In practice, there is no clear advantage in distinguishing the two, and not always a clear line dividing the two either.
<q> is gone
It has been replaced by <quote>, which has slightly different semantics with respect to quotemarks. In HTML4, user agents were technically forced to add quotemarks, regardless of CSS. In xHTML2, you get to add quotemarks either in the document, or in the stylesheet, depending on your personal authoring style and preference.
<cite> is gone
This decision has been reversed and it will return in the next draft.
<img> is gone
It was already on its way out in HTML4, and is replaced by <object> which provided much better capabilities for fallbacks and alternate text.
<applet> is gone
It was already deprecated in HTML4, and is similarly replaced by <object>.
<br> is gone
It is replaced by the more structurally sound <l>ine element.

Do I expect XHTML2 to be used the moment it enters the Candidate Recommendation stage? Of course not! The fact that xHTML2 won't be widely used before the end of the decade is not a problem. For some reason, the Internet populous has this strange idea that if something isn't adopted overnight, it must be a failure. Things take time! You have to get the spec implemented, and you have to get the implementations into the hands of the public at large, before big sites will even consider switching to a new technology.

And for those people who actually want a widely supported layout language, don't care about accessibility, don't understand the difference between semantics and style, and don't want to use PDF, then HTML 3.2 is still a W3C Recommendation, and will remain supported for a long, long time. Nobody will be forcing anyone to use XHTML2 on their sites if they don't want to.

Pingbacks: 1 2 3