New Features We Probably Won’t Get To Use

posted on June 14th, 2005 by Anthony

Well not until Critical Patch 3123 of Service Pack 2 for IE 9.55 at least.

The link for the seventh draft of the XHTML 2 spec dropped into my inbox last week, so I thought I’d have a look to see what’s planned. I’m sure you’re all up on it, and it’s probably only me that hasn’t seen the other six drafts, but I’m going to share the basics anyway!

Plus it’s always fun cutting through their wonderfully plain English…

The basic premise of XHTML 2 is to cut it even further back to it’s roots, and just get it to doing what it was originally designed to do – i.e. display text on a screen.

So the basic points are:

So that all sounds very nice and cosy doesn’t it?

Well no it doesn’t, not really. All you want to know about is the new tags, the deprecated tags, the attributes – all the juicy bits. And there are some too. Some pretty cool ones. There aren’t huge amounts of them, but what they lack in numbers they make up for in terms of significance…

Sections and Headings

Well the days of h1, h2, h3… etc are numbered. We are all soon to be using <section> and <h>.

So expect to start using this sort of thing:

<h>Main Title</h>
<section>
  <h>Sub Title</h>
    <p>Lorem ipsum blah de blah</p>
    <p>Lorem ipsum blah de blah</p>
</section>
<section>
  <h>Sub Sub - And It Ain't No Love - Title</h>
    <p>Lorem ipsum blah de blah</p>
    <p>Lorem ipsum blah de blah</p>
</section>

Which means our CSS will change from:

h1 { font-size: 1.6em; font-weight: bolder; }
h2 { font-size: 1.4em; font-weight: bold;}
h3 { font-size: 1.2em; font-weight: bold; }

to something like:

h { font-size: 1.6em; font-weight: bolder; }
section h { font-size: 1.4em; }
section section h { font-size: 1.2em; font-weight: bold; }

OK, so all this is new different, and more semantic, but it’s not exactly very exciting.

Bye Bye br

Also pretty unexciting is the replacement of the long standing <br /> in favour of the letter <l> – as in Line. So now we’ll have:

<blockquote>
  <l>A line of a poem</l>
  <l>Then another</l>
  <l>Followed by a third</l>
</blockquote>

Amazing…

So Long hr

The Horizontal Rule is being dumped for no being semantic enough. It’s going to replaced by the much longer to type <separator> It makes more sense to look at – but I don’t want to type it out more than I have to!

Changes to p

The paragraph is the backbone of most pages. In the past it had a few draw backs. Namely you couldn’t actually include a lot of normal entities of a real world paragraph. For instance a list, table, or quote would have to be included on it’s own, and not nested inside the p tags.

From XHTML onwards, however, you will be able to include these elements inside a paragraph.

<p>Some text leading up to a list:

 <ul>
  <li>List Item 1</li>
  <li>List Item2</li>
  <li> List Item3</li>
 </ul>
 
...now see, that was fun!</p>

Again this isn’t a huge leap forward, but it should mean some interesting new possibilities with CSS.

Sensible Lists!

This is one of the first really interesting changes. Especially from an accessibility point of views. Most sites that try to use Web Standards have their main navigation held in lists. This is fine, but from a semantic point of view it doesn’t tell the user the whole truth.

So XHTML 2 sees the addition of the Navigation List <nl></nl> to the existing Ordered <ol></ol>, and Unordered Variety <ul></ul>. This should mean that the browsing software being used will instantly know that the list it is trying to use might not contain any actual, useful information. The user should then be able to make an informed choice on if they want to skip it or read it. Maybe!

Every Navigation list will have to start with a <label> to identify the relevance of the list:

<nl>
  <label>Site Navigation</label>
  <li href="link1.htm">Home</li>
  <li href="link2.htm">Link</li>
  <li href="link3.htm">Etc Etc</li>
</nl>

A very nice introduction, that will be very useful methinks.

Spot the deliberate mistake?

Now before any of you eagle eyed pedants fire off the comments and point out my cock up with links above, just calm down and listen!

The venerable anchor is quietly being pushed out of the back door. You see with the new version ANY tag can be a link.

<a> is still going to be supported, but the little fella is going to find himself without too many friends in the coming years. Awwww!

Now even better than that!

If you thought being able to href any tag was interesting, how about this:

<h href="home.htm" src="companylogo" type="image/png, image/gif">Company Logo</h>

That’s right you will also be able to attach a source to ANY tag.

Unless I’m reading it wrong this is like in built Image Replacement:

"If the resource is unavailable (because of network failure, because it is of a type that the browser can’t handle, or because images have been turned off) then the element is used instead."

To me, and I’m probably getting my hopes up far too much here, this sounds like at first the browser will try to load the graphic. If it’s successful, the graphic will display and the text between the associated tag will not. However, if the something goes wrong and the image cops out, the normal text will be displayed?

Whether it will be as good in principal as it sounds on paper is another matter – but it’s certainly a huge step in the right direction.

Also you should have noticed something odd with the src and the new type attributes in the code there. By not specifying a file type in the src you can serve different file formats to different agents. I have my doubts on the usefulness of this, as there aren’t an awful lot of formats these days that don’t cross platforms, but it may be useful.

Other things

They are all the biggies really. There are a couple of other changes, including <del> being replaced by <edit> to more accurately describe what the tag actually does.

Also a new attribute called <role> is being introduced. Information about it is a bit sketchy, but it seems to be an addition to class and id that more semantically describes what a tag is doing. For example <p role="comment">.

Anyway, I hope somebody finds all that useful. If there any errors, or stuff doesn’t make it into the final spec don’t come and hunt me down! Some, if not most, of this won’t happen. Or if does happen the support will be sketchy, as there isn’t much up there that is already supported – even by FireFox.

However the W3C assure us that:

“Much of XHTML 2 works already in existing browsers; much, but not all: just as when forms and tables were added to HTML, and people had to wait for new version of browsers before being able to use the new facilities…”

So we can all expect our day to day headaches to remain for many years to come!