Bugzilla – Bug 756
add check that values of event-handler attributes are valid JavaScript code matching the FunctionBody production
Last modified: 2011-01-14 07:24:10 CET
http://dev.w3.org/html5/spec/webappapis.html#event-handler-content-attributes states "Event handler content attributes, when specified, must contain valid JavaScript code matching the FunctionBody production. [ECMA262]"
Closure Compiler has a API that could possibly be used for syntax checking of JS source. http://code.google.com/closure/compiler/docs/api-ref.html So we could run an instance of Closure Compiler as part of v.nu, and post contents of attribute values to it as js_code with the output_info= errors param, check the result
(In reply to comment #1) > Closure Compiler has a API that could possibly be used for syntax checking of > JS source. > > http://code.google.com/closure/compiler/docs/api-ref.html > > So we could run an instance of Closure Compiler as part of v.nu, and post > contents of attribute values to it as js_code with the output_info= errors > param, check the result Actually, we can just call Closure Compiler programatically: http://bolinfest.com/closure/CallCompilerProgrammaticallyExample.java it's not clear to me yet if it when you specify that you only want error-message output, it actually still tries to compile the JS source or not. I guess probably isn't, but would need to check. If it is then I guess we'd want to patch the sources to not have it try to do any compilation at all, but instead to just report any errors it finds, and otherwise do nothing.
*** This bug has been marked as a duplicate of bug 808 ***