Developing Asynchronous JavaScriptTM And XML (Ajax) applications, whether you use
pre-existing toolkits such as the Dojo Toolkit or develop everything
from scratch, can introduce challenges. The
challenges typically arise from two main issues.
If you have written a custom widget similar to the following example on the Dojo Toolkit, you can get errors reported in tools such as Firebug; for example: Could not
create widgets in dijit_layout_ContentPane_2 from templates/tabs.html Error:
Could not load class 'foo.Bar'. Did you spell the
name correctly and use a full path, like 'dijit.form.Button'?
The message does not explain the problem, only that it did not load a particular widget. This error can be caused by multiple programming errors; however, the most common ones are syntax errors in the widget JavaScript. The following most common syntax errors cause the previous error:
Most lint processors identify the previous errors and more. Many of the lint processors also enforce that JavaScript program statements typically end each line with a semicolon. While ending with a semicolon is considered optional in JavaScript, it is highly recommended to use for strictness and uniformity. In summary, using lint syntax checking saves development time when trying to find the misplaced comma, malformed function, or missing closure. |
Assuming that all the
syntactical
errors were caught by running a lint on the JavaScript code and
corrected, the next set of problems are all related to runtime
problems. These issues are more complex to debug, as the
various browsers do not report errors in the same way.
Therefore, as a JavaScript developer, you must
become familiar with debugging tools and browser error reporting
mechanisms that are specific to each of the major supported browsers on which your application is used. The following list outlines how some
of the more well-known browsers report errors:
The most common errors encountered at run time tend to be:
|