Bug Tracker

Opened 12 years ago

Last modified 12 years ago

#7706 closed bug

jquery.tmpl appears to execute ${} content tag 4 times — at Version 3

Reported by: corydodt Owned by:
Priority: undecided Milestone: 1.6
Component: templates Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by danheberden)

Try adding this to a template:

${console.log("hello")?"":""}

(This logs to the console and discards the undefined return value.)

"hello" appears 4 times in the js console.

Observed in: Chromium 7 and Firefox 3.6 (firebug) Observed in: Windows7 and Linux Observed in: jquery.tmpl beta1

I will attach a test document that demonstrates this behavior.

Change History (3)

comment:1 Changed 12 years ago by corydodt

Please note that any expression there will be executed 4 times. This is not limited to console.log(). You could use a global counter and x++ instead. The value of x will be 4 times as high as you expected.

Learning how to use jsfiddle now so I can post this attachment...

comment:2 Changed 12 years ago by corydodt

Here we go: jsfiddle bug 7706 quadruple execution

comment:3 Changed 12 years ago by danheberden

Description: modified (diff)

Another template example that shows the variable not incrementing http://jsfiddle.net/danheberden/UpkCV/

Note: See TracTickets for help on using tickets.