bloudraak/htmlcompressor

htmlcompressor doesn't like <script> in commented out <!-- --> blocks

Closed this issue · 2 comments

What steps will reproduce the problem?
Compress the following html:

<!--<option value='same'><script
type="text/javascript">document.write('hi');</script>-->

What is the expected output? What do you see instead?
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at
java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:79     
         7)
        at java.lang.StringBuilder.replace(StringBuilder.java:271)
        at
com.googlecode.htmlcompressor.compressor.HtmlCompressor.returnBlocks(     
         HtmlCompressor.java:172)
        at
com.googlecode.htmlcompressor.compressor.HtmlCompressor.compress(Html     
         Compressor.java:107)
        at cmdlinehtml.main(cmdlinehtml.java:40)


htmlcompressor.0.7.1 windows

Original issue reported on code.google.com by joesiegr...@gmail.com on 29 Sep 2009 at 10:50

[deleted comment]
Fixed in 0.7.2 release.
Had to rethink a block preserving algorithm but as a result performance also 
slightly
improved.

Thanks.

Original comment by serg472@gmail.com on 1 Oct 2009 at 3:24

  • Changed state: Fixed