ColdBox Framework Forums Notification: Post to Debug panel output interferes with page js

Title: Debug panel output interferes with page js
Thread: Debug panel output interferes with page js
Forum: Discussions
Conference: ColdBox
User: danfusion I recently ran into an issue while designing an application that has dynamically
generated javascript and html. The js and html would be generated and saved to a
variable that is then passed to the view. It worked well and I didn't have any
trouble until I tried turning on the debug panel. Every js event would fire
twice! What?!

I spent hours trying to figure out where this could be coming
from until the obvious answer hit me. I opened up the "request collection
structure" panel (normally closed) and suddenly realized... duh, my generated
html and js was appearing twice on the page, but hidden in the debug panel. A
quick change to save the js into a separate variable that is outputted into
<script> tags in my view fixed the problem.

Because this seems to be a
"gotcha" only when you are placing javascript code into variables in rc I didn't
post it in the bug forum. I wanted to give Lois (and everyone else) the heads
up. Perhaps sanitizing the output in the debug panel might be a good idea in
future releases of ColdBox.