NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 756 - add check that values of event-handler attributes are valid JavaScript code matching the FunctionBody production
add check that values of event-handler attributes are valid JavaScript code m...
Status: RESOLVED DUPLICATE of bug 808
Product: Validator.nu
Classification: Unclassified
Component: Datatype library
HEAD
All All
: P2 normal
Assigned To: Nobody
http://dev.w3.org/html5/spec/webappap...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-13 03:58 CEST by Michael[tm] Smith
Modified: 2011-01-14 07:24 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael[tm] Smith 2010-07-13 03:58:18 CEST
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]"
Comment 1 Michael[tm] Smith 2010-07-13 08:06:23 CEST
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
Comment 2 Michael[tm] Smith 2010-11-27 07:15:13 CET
(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.
Comment 3 Michael[tm] Smith 2011-01-14 07:24:10 CET

*** This bug has been marked as a duplicate of bug 808 ***