The cause, as ever, was caused by browser inconsistencies whereby Internet Explorer was doing something completely different to everyone else. What a surprise.
Now I’ve encountered such problems in the past, and have always been able to hack my way around them, but this time I couldn’t.
The problem came in on some popup code I had written for Transdiffusion. The URLs for the links include widths and heights, and look a little like this:
<a href="/path/to/popup.php?width=200&200" class="popup">open popup</a>
My original code – hand cranked the hard way and created after much gnashing of teeth – worked fine, until (Transdiffusion’s chief editor) Richard decided to try putting one round an image instead of just putting it round text.
This, of course, works fine in most browsers. But not Internet Explorer. I tried every trick I could think of, but no joy.
Popping to the library
So it was with great reluctance that I went elsewhere and found Yahoo’s event library which solved the problems for me.I must say, is rather good.
So psychologically it was a bit of a hurdle to suddenly use someone else’s.
There were many excuses going round in my head – the main one being that my original code was about 4k – three times smaller than the code I was looking at using instead. This was generally followed up with a bit of a reluctance just to use anyone elses code – that it was somehow wrong.
Go on then, impress me
In short, it was a doddle. This is, for my money, some wonderful code. Someone (probably a few people) has put some serious thought and effort into it, and has made it work well.
And that’s what you want from a library piece of code – someone to do the hard work for you, so that you can get on with it and do what’s actually important for your website.
To be frank, I never even got close to arguing about my third potential problem with using the library – Yahoo have released the library under a BSD license, meaning you can do pretty much anything you want with it.