Archive for the ‘javascript’ Category

Internet Explorer Developer Toolbar

March 7, 2007

Firefox performance problems with Firebug

February 22, 2007

I use the firebug extension in firefox very frequently, and I really recommend it. However, it does appear to cause some problems, at least when running firefox on Linux.

When firebug is running, firefox seems to freeze up for a second or more, and the cpu load spikes up. In a new firefox session, everything seems to work fine. But over time, the problem gets worse, and I usually end up having to restart firefox at least once daily. Really a bummer for productivity.

I think I found at least a partial workaround: by disabling firebug when I’m not actively using it, the problem is much less severe. I can’t say that it goes away completely, but at least firefox is still usable.

On the firefox menu: Tools -> Firebug -> Disable Firebug

Cross-browser JavaScript

November 18, 2006

Working on a web application, dealing with some cross-browser JavaScript issues. My main development platform is Firefox + FireBug extension, and I had everything working there just great. It took a while to get it working on other browsers — recording lessons learned here.

Lesson 1: Firefox – Opera – IE

After getting things working in Firefox, I found the next best platform for testing is Opera. Opera’s JavaScript engine seems a bit stricter on some things that Firefox, so it generates errors on things that Firefox handles fine. While not nearly as nice has FireBug, Opera does have an Error Console feature that is pretty clear on both the location and the meaning of the errors.

Finally it comes to testing Internet Explorer — IE6 to be precise. The tools for JavaScript debugging in IE6 are awful, it is a painful experience. So do all your testing on other platforms first.

Lesson 2: The real issues

Once I figured out a good debugging strategy, it wasn’t too hard to fix my problems. It came down to a few syntactic constructs that I now know to avoid in the future:

  • Don’t use assignment in an if() statement
    • Okay in Firefox and Opera:
      if ( foo = something() ) { ... }
    • Alternative that works in IE6 as well:
      var foo = something(); if ( foo ) { ... }
  • In hash / object construct, don’t leave dangling ‘,’ after last pair
    • Okay in Firefox:
      { a: 1, b: 2, c: 3, }
    • Alternative for Opera and IE6:
      { a: 1, b: 2, c: 3 }