Debugging JavaScript with jsTrace
By Jeremy Keith | October 27th, 2005 | Filed in Authoring Tools, DOM, DOM Scripting TF
Aaron Gustafson gives us a very handy tool for debugging scripts: jsTrace.
Skip to comment formThe alert
function is both incredibly annoying and very useful at the same time. It’s annoying if you’re visiting a site and you’re suddenly assaulted by a dialogue box. But it’s very useful if you’re debugging a script and you need to find the value of a variable at a given time: simply insert an alert
statement in the relevant place.
Still, at some point the annoyance begins to outweigh the usefulness.
Flash, meanwhile, has a much more unobtrusive way of displaying and tracking messages. Using the trace
command in Actionscript, you can write messages to a discrete window. The flow of your functions isn’t interrupted and you get a history of messages instead of clicking each one away.
Aaron Gustafson has taken the idea of tracing and applied it to JavaScript debugging. jsTrace is handy little script that you can drop into any page to add traceable debugging. View the demo to see it in action. The trace window can be made draggable with the inclusion of Aaron Boodman’s DOM Drag.
This could prove to be a very handy tool for debugging scripts. And when you’re finished debugging, you can remove the link to the jsTrace script but still leave the trace commands in your code.
If you have any feedback on the script, you can leave a comment on Aaron’s blog, Easy Reader.