44.2. Debugging Client-Side JavaScript
One of the most anticipated new features of Visual Studio 2008 is the improved support for debugging client-side JavaScript code. Combined with the new IntelliSense support, this will significantly ease the difficulty of developing JavaScript code.
JavaScript debugging works only if you are using Internet Explorer as your web browser during the debug session.
44.2.1. Setting Breakpoints in JavaScript Code
Setting breakpoints for JavaScript code is no different from setting any other breakpoint. Within the editor window any breakpoints in JavaScript code are displayed with a diamond in the center, as shown in Figure 44-6.
Figure 44.6. Figure 44-6
JavaScript breakpoints have the same functionality as standard breakpoints. This includes setting conditions, hit counts, or even running a macro as part of a tracepoint.
When the debugger hits a breakpoint it will pause execution and display the HTML code that has been rendered on the client, as shown in Figure 44-7. This provides a true debugging experience because it includes all client-side elements such as the ViewState and server controls rendered in HTML.
Visual Studio 2008 has also improved the watch visualizers for client-side elements. Figure 44-7 demonstrates this with a tooltip that shows the properties and methods of the document object.
Figure 44.7. Figure 44-7
It is also possible ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access