Closed GoogleCodeExporter closed 8 years ago
Running the scripts inside the AJAX response would require calling eval() which
is discouraged and is not fully supported by the compiler. I also suspect that
mixing the HTML with scripts have security implications.
I suggest keep the form validation code inside your JS binary and attach it to
the DOM when you replace the dialog's content.
Original comment by pall...@google.com
on 18 Jun 2010 at 11:45
Thanks for your response.
I don't know how jQuery does it, but considering they run scripts by default in
both their .append() and .html() functions I'm not convinced that we can simply
dismiss this as "bad practice". Not being fully supported by the compiler is of
course a valid point.
The reason I chose inline scripting was because I wanted a close connection to
the html form implementation, because the script was very small, and because I
wanted to avoid another http request for such a small and content-specific
script. The general form validation library and settings is of course loaded as
an external library together with other larger scripts.
I will reconsider placing the code in a separate js-file, because I guess it
can be cached by the browser which would avoid the additional http request, but
I still think you should consider the possibility of adding script support to
Closure functions that add html content, considering the latest version of
jQuery does this.
Thanks.
Original comment by hannes.ryden@gmail.com
on 18 Jun 2010 at 2:30
Original issue reported on code.google.com by
hannes.ryden@gmail.com
on 18 Jun 2010 at 2:25