XHTML 1.1 

Although I'm not quite sure why yet, I changed the doctype of this template from XHTML 1.0 to XHTML 1.1 and am sending a Content-type: application/xhtml+xml header to browsers that support it, meaning Mozilla will regard each page as xml and won't show the content if there's an error in the markup.

Which meant spending a couple of hours going through the monthly archives, correcting each entry that triggered an xml parse error. Now all of the 2300+ entries are valid well-formed x(h)tml and I have learned to never ever not end my &'s in amp; or use < instead of &lt; in javascript: hrefs (damn those bookmarklet for-loops).

Remaining Javascript-weirdness resulting from the switch:

  • document.write (which I use to generate spam-safe mailto: links) no longer works, I'll have to use a more DOMmy method (explained here);
  • The 'hide searches' link above the Referrers disappears after the first click, something to do with my use of innerHTML no doubt.
Update 1: Okay, the 'hide searches' thing was easy to fix; I can simply set .firstChild.nodeValue instead of .innerHTML to make the link text change.

Update 2: My new method of generating mailto: links is as follows: I write out email addresses in this form
<span class="mailto">domain,account,name</span>
which is converted to
<a href="mailto:account@domain">name</a>
by the following function:

function setMailtoLinks()
{
  if (!document.getElementsByTagName) { return; }
  ar_spans = document.getElementsByTagName('span');
  for (i=0; i<ar_spans.length; i++)
  {
    if (ar_spans[i].className == 'mailto')
    {
      ex = ar_spans[i].firstChild.nodeValue.split(',');
      tmp = document.createElement('a');
      tmp.href = 'mailto:' + ex[1] + '@' + ex[0];
      tmp.appendChild(document.createTextNode(ex[2] ? ex[2] : ex[1] + '@' + ex[0]));
      ar_spans[i].replaceChild(tmp, ar_spans[i].firstChild);
    }
  }
}

comments

1. posted by JW at 17:30 on October 30, 2003

Nice piece of work. I am still wondering if I will use the application/xhtml+xml content header. One of the reasons: checking every single entry I posted sofar.

2. posted by Arthur! at 18:22 on October 30, 2003

I've changed my content-header and all my pages work. I use MT as CMS and I've used a couple of plugins that replace 'non-validating' content. It's not perfect (yet) but at least it works.

I haven't had any problems since I switched. I don't think the 'fear' of checking every page should stand in the way of changing you content-header.

3. posted by pinder at 22:56 on October 30, 2003

for some reason, in Firebird, if i try middleclicking on a link on milov.nl, i get the logitech scroll wheel instead of opening the link in a new tab. but middle clicking works fine on any other site. anyone else experiencing this? does it have anything to do with the doctype?

4. posted by milov at 23:02 on October 30, 2003

I hadn't noticed it yet (using a graphics tablet without a middle mouse button) but yes, it's apparently a Firebird bug resulting from the new doctype / application/xhtml+xml header. The same thing happens on http://simon.incutio.com/ and http://annevankesteren.nl/ .

5. posted by mkt,bob,Bob at 23:35 on October 30, 2003

I am almost done with a redesign of my site, and while the templates and stuff validate as xhtml 1.1 just fine, I _really_ am not looking forward to going through all my old crap to make sure it validates.

Dikke pluim in je reet, dat jij daar wel zin in had!

6. posted by mijnkopthee.nl,bob,Bob at 23:37 on October 30, 2003

Hey! Why doesn't your comment-thingy display my name?

7. posted by Bob at 23:38 on October 30, 2003

(sorry for spamming, just checking to see if it _does_ work if i enter an URL instead of an email address)

8. posted by milov at 00:55 on October 31, 2003

Bob: your name not being shown is a result of the document.write problem I mentioned; the spam-safe mailto: link (which is shown when people don't fill in an url but do leave their email address) doesn't appear...
Anyway, it's fixed now.

add a comment

Note: no HTML allowed. URLs starting with http:// are automatically turned into working links. Please don't spam.