2008

2007

IE6 strikes back

▁ sep 30 2008

It was a dark and stormy night, and one of the web developers looked up from the screen. «There’s something wrong with the Javascript on this page in IE6… I think it’s getElementsByClassName!» As the second web developer quickly did a Google search, he already knew the answer - that the other developer was right, and that he accidentally had used a function from HTML5 not supported in IE6.

This riveting story was taken from real life, and happened to me tonight. Working overtime. On a project long overdue. Kind of not the time you want to find out things like that. Yes, you can blame me for not testing in IE6, and you’re right to do it, but in my mind I was using a perfectly normal Javascript function. Oh well.

In this instance we solved it by finding the right elements with jQuery, $('.classname'), and it works even in IE6. The reason I didn’t do it like this in the first place, is that this is my first project where we use jQuery at all, and we didn’t have such fancy things back in the old days when I first started programming Javascript.

When programming Javascript, the code has a tendency to seem very brittle - like it’ll break horribly by the slightest typo. The somewhat cryptic error messages (“object expected”, anyone) in browsers is probably at fault here, and the write-browse-debug loop feels awkward compared to other programming environments.

Firebug has helped, but there’s still room for improvement. I feel I have to think and write more about this when I get the chance.

Edit: It was actually IE7, not IE6.

← Previous: JavaZone 2008  //  Next: Call me teacher

comments

powered by