htmlcompressor icon indicating copy to clipboard operation
htmlcompressor copied to clipboard

<script> in comments

Open GoogleCodeExporter opened this issue 9 years ago • 1 comments

What steps will reproduce the problem?

Next piece of html is compressed incorrectly 
<!--<script type="text/javascript" src="..."/>-->
<script type="text/javascript">document.write('hello')</script><!--some more 
comment-->

What is the expected output? What do you see instead?
The compressed output is empty. but is should be 
<script type="text/javascript">document.write('hello')</script>

What version of the product are you using? On what operating system?
1.4

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 30 Jan 2012 at 8:35

GoogleCodeExporter avatar Nov 27 '15 21:11 GoogleCodeExporter

<script type="text/javascript">
    if (!window.init) {
        window.init = function(){}; //Adding to fix problem with init undefined.
    }
</script>

With the above script I get following exception

[ERROR] HtmlCompressor: "missing } in compound statement" at line [1:133] 
during JavaScript compression:  window.editMode = false;    if (!window.init) { 
       window.init = function(){}; //Adding to fix problem with init undefined. 
   }
[ERROR] HtmlCompressor: "Compilation produced 1 syntax errors." at line [1:0] 
during JavaScript compression
Exception in thread "main" org.mozilla.javascript.EvaluatorException: 
Compilation produced 1 syntax errors.

Original comment by [email protected] on 7 May 2015 at 10:42

GoogleCodeExporter avatar Nov 27 '15 21:11 GoogleCodeExporter