The javascript code contained in bugtask-index.pt should go into a separate file

Bug #364684 reported by Abel Deuring
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
Unassigned

Bug Description

Javascript stored in a Zope page template is messy:

(1) lint spits out lots of errors for the Javascript text
(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\'>')

Tags: lp-bugs
Revision history for this message
Eleanor Berger (intellectronica) wrote :

Let's try to do this soon, so that the template doesn't get even harder to edit

Changed in malone:
importance: Undecided → Medium
milestone: none → 2.2.4
status: New → Triaged
Abel Deuring (adeuring)
Changed in malone:
status: Triaged → In Progress
Revision history for this message
Björn Tillenius (bjornt) wrote : Re: [Bug 364684] [NEW] The javascript code contained in bugtask-index.pt should go into a separate file

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.

Revision history for this message
Abel Deuring (adeuring) wrote : Re: [Bug 364684] [NEW] The javascript code contained in bugtask-index.pt should go into a separate file

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.

Revision history for this message
Diogo Matsubara (matsubara) wrote : Bug fixed by a commit

Fixed in devel r8283.

Changed in malone:
status: In Progress → Fix Committed
Changed in malone:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.