JavaScript and CSS: Failures and Gotchas in IE 6

There are few parts of the web developer's job that are more frustrating than getting things to work right in Internet Explorer.

I've read that it's good practice to develop for the most standards compliant browser available, and then tweak as necessary to achieve cross-browser compatibility. Generally, I agree, but once you have a completed web application it can be very difficult to debug in Internet Explorer, since the error messages are usually substantially less than helpful. The error reported is often vague, and in my experience the line number provided is incorrect about half of the time. Some things may be improved in IE7, but it's not yet safe to assume your users will have upgraded.

I've developed several web applications for Firefox that I've then modified to work in Internet Explorer 6. With experience you learn to avoid a lot of potential problems. For example, specifying a doctype will avert many of Internet Explorer's more egregious CSS rendering offenses (more info on that here). More generally, if there are two ways to accomplish something, and both work in Firefox, but only one works in Internet Explorer, you're better off just using the one that works in both right from the start, even if it's less elegant. So a lot of the more famous and obvious problems with Internet Explorer's implementations of JavaScript and CSS don't really affect me anymore, but I still get hit by surprises now and then, when I try to do something obscure and discover an oddly specific failing or difference - sometimes after hours of frustrating debugging. When that happens, I take note of it, so that that particular problem won't catch me off guard again. Here's the current list, so that you can be prepared too.


JavaScript Variable Names


JavaScript Variable Handling


HTML/CSS Rendering


Event Handling


DOM Manipulation