Debugging Javascript in Domino applications the sane way.
A couple of weeks ago I blogged about the css editor in Visual Studio,
now I want to tell you about debugging your JavaScript routines using the
Visual Studio debugging environment.
After years of using JavaScript alerts to debug my Domino applications,
I'm happy to report that those days may be over. Currently I am working
on an application that is being designed for a company that uses IE as
their standard browser. As I test the application I occasionally hit an
error (its so hard not being perfect :-) )that causes the debugging event
in IE to prompt me with an error message and the opportunity to debug my
code. When I select Yes to debug, I'm presented with a list of options
for displaying my code and the error.
Now that I have Visual Studio installed it is listed as a debugging option
along with the Microsoft Script Debugger which I also have installed. The
Microsoft Script Debugger only tells me which line of code the browser
is having a problem digesting. Visual Studio tells me so much more.
Yesterday I was looking at a problem with a JS routine that I was adapting
from another application. Its a simple function that receives the name
of a span and determines whether to expand or collapse it. Not only was
the Visual Studio debugger showing me the line of code that raised the
error, but when I click the Locals tab I could see the value of the relevant
HTML/DHTML objects and the javascript variables that are in play. I was
able to check to see if the parameter passed to the function was the correct
value and I could look at the values associated with the Document Object
Model.
In another example, I was getting an
error telling me that a style reference that was created dynamically was
either not an object or null. By looking at the variable used to create
the style reference I was able to see that I had a caching problem and
that the value being passed was incorrect and did not reflect what I was
seeing in Domino Designer.





-