On 22.04.2009 19:16, Björn Tillenius wrote:
> On Tue, Apr 21, 2009 at 03:42:44PM -0000, Abel Deuring wrote:
>> (2) If a '"' (double quotation mark) appears in JS, we'll get an error when the template is parsed. This leads to ugly, difficult to read code like node.set('innerHTML', '<a id=\'x\' class=\'y\' href=\'z\'>')
>
> This is because we use tal:replace="string: $js-code", in order to be
> able to easily customize the code, getting data from python. Moving the
> code to a separate file won't make this any better.
>
When we load the JS code via <script type="text/javascript"
src="https://..."> we can avoid these escapes. I also noticed that "make
lint" catches some problems in "real" JS files which remain unnoticed if
the JS code is embedded in a page template.
On 22.04.2009 19:16, Björn Tillenius wrote: 'innerHTML' , '<a id=\'x\' class=\'y\' href=\'z\'>') "string: $js-code", in order to be
> On Tue, Apr 21, 2009 at 03:42:44PM -0000, Abel Deuring wrote:
>> (2) If a '"' (double quotation mark) appears in JS, we'll get an error when the template is parsed. This leads to ugly, difficult to read code like node.set(
>
> This is because we use tal:replace=
> able to easily customize the code, getting data from python. Moving the
> code to a separate file won't make this any better.
>
When we load the JS code via <script type="text/ javascript"
src="https://..."> we can avoid these escapes. I also noticed that "make
lint" catches some problems in "real" JS files which remain unnoticed if
the JS code is embedded in a page template.