Wednesday, November 28, 2007

Frank Advice From Firefox

I have a new favorite error message from Firefox. I attempted to use an object attribute named class and was greeted with this wisdom:

Error: used an attribute named class in: span, [object Object]. This won't work in IE. Don't do it.

Simple, direct, accurate. I love it.

Now compare this to basically the same problem I ran into earlier today. I had:

  var foo = { for: 'baz' };

Of course, that's not Kosher because for is a reserved word. Firefox didn't mind. IE, on the hand gave me its stock message: (something like) String or Object expected, line 84. The best part is that: (a) it doesn't say line 84 of which file (or universe for that matter) and (b) the script debugger brings you to a totally different line (not 84, and not related to the problem).

Good, I know the problem is on line 84. Now I just need to build a bigger and better super computer to tell me which actual line of code line 84 belongs to.

Amazing. So not only does Firefox do a better job of debugging, but now, as the first message shows, it's doing a better job of debugging IE too!

Update: I just poked around the code that threw this error - turns out, I wrote that error message. So this advice isn't really so much from Firefox, as it is from Past Ben to Future Ben.

No comments:

Post a Comment