OMG ponies!

A certain someone has been prodding me to start blogging again, and my excuses have finally run out, so here's a random post to get started again with.

I've just cleared out four months' worth of caught spam (hooray for Habari's spam catcher!), and sorted through all the unapproved (mostly spam) comments. This "spamment" in particular made me smile, if only for its sheer cheek:

Please, do not delete the given message. Money obtained from spam will go to the help hungry to children ugandn

To all the hungry to children ugandn out there: I'm sorry, my finger slipped.

In other news, I've recently started to teach myself Python, and I've been amazed at how well it "fits my brain", as someone else once said about a programming language. Python is incredibly easy to pick up (at least if you already know the basics of programming), and I've found myself becoming quite at home with its idioms -- unlike when I tried Ruby, sadly. I'll have to give Ruby another try one of these years. Its class and inheritance syntax makes more immediate sense to me, that's for sure.

I've also upgraded Habari now, which was pleasantly painless to do. I'll make my own theme for it one of these days, when I've got something better to do.

STOP PRESS: Microsoft to make IE8 standards-compliant by default!

I'm stunned. This is not what I expected. Some sort of concession, maybe, but nothing like this. Way to go, Microsoft!*

From the IEBlog post:

We’ve decided that IE8 will, by default, interpret web content in the most standards compliant way it can.

I personally consider this fantastic news. I was broadly opposed to the version targeting idea as presented, i.e. that it would be an "opt-in" system, but had largely resigned myself to either ignoring it, or suffering it if I deemed the new CSS/JavaScript shinies in IE8 worth the effort.

Any site needing IE8 to render in IE7 mode (for whatever reason) need only apply a one-line fix: the meta version targeting method originally proposed to work the other way around (or the HTTP header equivalent).

In summary, this is the good news, as I see it:

  • Developers need do nothing beyond using current standards to get the best standards-compliance from IE8.
  • The change should encourage developers to adhere more strictly to existing standards, particularly if doing so enables more advanced CSS and JavaScript capabilities in IE8.

This should also mean that IE8 will automatically pass the Acid2 test, rather than requiring a nudge to do so. From the Microsoft press release:

IE8 has been significantly enhanced, and was designed with great support for current Internet standards. This is evidenced by the fact that even in its first beta, IE8 correctly renders the popular test known as 'Acid2', which was created by the Web community to promote real-world interoperability [...] Our initial plan had been to use IE7-compatible behavior as the default setting for IE8, to minimize potential impact on the world's existing Web sites. We have now decided to make our most current standards-based mode the default in IE8.

And this is the potentially bad:

  • Anyone requiring, for some reason, IE8 to behave as IE7 will need to add the meta switch or the HTTP header to their code.
  • More inconvenience in the short term for anyone supporting legacy documents.

I'm very impressed by Microsoft's move, and hope that it doesn't somehow get overruled or watered-down before IE8 is released.

(*I can honestly say that I never thought I'd write that - "never say 'never'", I guess!)

Fixing <abbr> in IE with one line of JavaScript

One positive side-effect of the recent sugarstorm surrounding the announcement that IE8 will, as things stand, require developers to opt in to its new standards mode is this comment by Sjoerd Visscher, which I read several days ago but have been too preoccupied to post about until now. The (in)famous Ian Hickson referred to Sjoerd's revelation as "...probably the most noteworthy news of the day."

As soon as I saw Sjoerd's comment, I realised that the quirk could potentially provide a cruft-free and extremely simple, albeit JavaScript-dependent, solution to Internet Explorer's (pre-IE7) refusal to acknowledge the abbr element. One could of course use Dean Edwards' impressive IE7 library to haul IE into line regarding abbr and a great many other things, but I've always considered it overkill, and prefer to patch IE on a case-by-case basis. My preferred way to fix abbr in IE (with conditional comments):

<!--[if lt IE 7]>
<script type="text/javascript">document.createElement('abbr');</script>
<![endif]-->

Put that in your document's head section, et voilà, IE6 and IE5.5 now respect CSS styles for abbrs. The fix even makes IE display the title attribute tooltip on hover. Unfortunately, it seems not to work in IE5.01 - I can live with that limitation. The conditional comments should be optional, as I don't believe that the JavaScript would have any ill effect in other browsers (provided that they support document.createElement). It could also replace an existing script-based FOUC fix that developers may have employed.

Apparently, few people seem to have known about this fascinating IE quirk before, and as of the time I wrote this, I'd not seen anyone else mention its potential application to IE's abbr problem. I'm certain it's occurred to many people by now, but I'm noting it here explicitly because - quite honestly - it amuses me more than it should that such an annoying bug can be fixed in such a simple way. It also has interesting implications for "encouraging" IE to recognise new elements in HTML5.

Happy coding. :-)

CSS reset and quirky quotes