milov.nl

Interaction design • webdevelopment • web art • photography

October 2003

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);
    }
  }
}



JW wrote on 2003/10/30:
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.


Arthur! wrote on 2003/10/30:
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.


pinder wrote on 2003/10/30:
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?


milov wrote on 2003/10/30:
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/ .


Bob wrote on 2003/10/30:
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!


Bob wrote on 2003/10/30:
Hey! Why doesn't your comment-thingy display my name?


Bob wrote on 2003/10/30:
(sorry for spamming, just checking to see if it _does_ work if i enter an URL instead of an email address)


milov wrote on 2003/10/31:
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.