Textareas Can Be Helpful

© 2011, Martin Rinehart

While debugging I often write a "custom console." This is really just two textareas, one for input and the other for output. I type test code into the input area, eval it (don't tell Crockford!) and show the result in the output area. Here's a key difference between Opera and Firefox:

When you reload the HTML, Opera reinitializes the input textarea. Firefox caches and restores the input textarea content.

At first, the Opera behavior seems much more consistent with everything you know about HTML. And then you start to praise Firefox.

The point of testing is to find out what happens, and then to modify your code so that what you want to happen and what happens become one and the same. So the edit/test cycle is this:

  1. Enter test code in input area.
  2. Examine result in output area.
  3. Edit underlying JavaScript.
  4. Reload and repeat from top (maybe).

And it's that "repeat from top" that's different. In Firefox, the test code is still in the input area, so you're at step 2 after you press F5.

I object to inconsistency, most of the time. Sometimes, however, inconsistency can be so overwhelmingly useful that it's a good idea.

While I'm on the subject, Opera caches graphics. This is a huge pain if you are working on a page where the graphic is the thing you are editing. Most browsers let you reload the graphic. With Opera, you have to close and reload Opera itself. Ugh.

Sorry, Opera. I love you, but you're not perfect. I still love you, and I'd not even think about debugging without your Error Console. Now, if only you would load as fast as Chrome and . . .

Feedback: MartinRinehart at gmail dot com

# # #