God, how much I hate dealing with browsers. Initially when I wrote that script I tested on IExplorer 6 and IExplorer 8. I already had to deal with issues regarding the IExplorer 8 compatibility mode. I already had taken the decision to completely ignore IExplorer 7, as that was a fucked up release. Either way, it is possible that I completely wrecked IExplorer support with later changes that I failed to retest.
And all of this for a 233 lines script (including comments and whitespace). How fucked up is that?
This is also why I love JQuery so much. Unfortunately if you want to publish a reusable library it's extremely annoying to bring a dependency such as JQuery with it. Even though JQuery is popular, the latest release is a whooping 90K in size. Do you know how painful that is on mobile browsers? NO, infrastructure code has to be done for the lowest common denominator: that's why people still do complex shit in C. C is portable and you can link to C from any other library.
Either way, I might do a rewrite in CoffeeScript: at least that's going to save me the pain of dealing with syntax differences, as I've been having those kinds of problems too ;-)
So what to do?
- prefer CoffeeScript for development, not because it is cool but because it is sane
- Microsoft was kind enough to release virtual-machine images for testing your websites in various IExplorer versions - I'm installing them in VirtualBox right now using this script here: https://github.com/xdissent/ievms (many thanks to the author, I'll let you know how it goes)
- Always test with the 6 biggies: Firefox, Chrome, Opera, IExplorer 6, IExplorer 8 (watch out for the compatibility mode) and IExplorer 9
- There are few differences between Chrome and Safari, both being based on WebKit and V8 is pretty compatible with Safari's JS Engine, so I don't bother with it. But it doesn't hurt if you have it around.
- Mobile Safari and Android's browser are different from desktop Safari and Chrome. Do not assume that your shit will automatically work on mobiles.