I have an ad block with the code served by custom installation of OpenX. Code is presented abridged below.
<!--/* OpenX Javascript Tag v2.8.9 */-->
<script type='text/javascript'><!--//<![CDATA[
Code here
//]]>--></script>
<noscript>Fallback</noscript>
On the live website the code is being transformed as such (adjusted for clarity):
<!--/* OpenX Javascript Tag v2.8.9 */--><!--/* OpenX Javascript Tag v2.8.9 */-->
<script type='text/javascript'><!--//<![CDATA[
Code //]]>--><!--//<![CDATA[
Code repeated //]]>-->
</script>
<noscript>Fallback</noscript>
So it takes everything between HTML comments and doubles it (inside and outside of the <script></script>
tag).
Workaround: remove HTML comments from before the snippet, and CDATA comments inside the script. While this technically solves the problem, I still would love to have comments marking my snippets, and, I suppose, CDATA could be important for something as well.
What can be causing it? I do not have many optional modules installed. Main ones content related are the latest 6.x version of i18n (which is my main suspect, but I do not know how to troubleshoot it, not even sure I can safely turn it off without damaging the translated content), FaceBook integration, and, mayhaps, Devel.
Edit: This occurs with any code (formatted as “full HTML”, at least). HTML comments get printed twice, and if JS code happened to be between those, so would it.