Debugging techniques for JQuery
I am still a novice with javascript and jquery. I am developing code for a web site and the code is mildly complex, using HTML5, JSP, Javascript and Jquery. I have run into several problems when using JQuery so far. Some have been fairly easy to fix. Some not so easy. I find the debugging process to be fairly lengthy in time and was wondering if there are some techniques available that I am not aware of.
My current techniques that I use, some more that others are:
1) Read the code
2) use alerts method calls, although I have changed over to console.log() calls recently. The console works much better.
3) filter source code for certain strings to make sure reference names match up with object names
4) look at and fix errors reported in the console window by other modules
5) use a debugger for java source code
I plan to look at, but I have not yet looked at using a javascript debugger. Right now I don't have a lot
of javascript code but that will be changing as I am now getting into programming my client side code for
my application. My impression is that the javascript debugger is useful for debugging pure javascript, but
it may not be too useful for debugging javascript code with calls to JQuery methods. Is this a false
impression on my part? It would be nice if I can use it with mixed javascript/jquery code. Even better
would be if I can use a javascript debugger to go into the jquery source code. Will this work?
I know there is a non-minimized version of the JQuery libraries. Should I be using the non-minimized
version for development? If so, are there techniques for using that? Do I use a debugger? Do I insert
console.log statements as needed? Other?
Is there any way to read and parse javascript/JQuery for syntax errors without first reading it into a browser?
Can I use Rhino for this?
Is there any tool like the c/c++ lint tool that can be applied to javascript/jquery? I am guessing no, but
I thought I would ask.
Again, any comments and suggests will be welcome since they can only help my development process.
Jim A.