Yes, Paul, I had the content set to HTML and escape to "false", and I read the articles in lotus.wiki with the dojotoolkit.org already being my homepage :-)) the articles are were very helpful!
But getting back to business, I finally handled the problem by rewriting the script and printing the results on a step by step basis, amazingly - with no changes at all. This is not the first time when I get into such kind of weird behavior - I already reported a case when the code on the source pane is doubled when you copy/paste elements on WYSIWYG pane.