Export to GitHub

htmlcompressor - issue #3

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


Posted on Sep 29, 2009 by Massive Horse

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

Comment #1

Posted on Oct 1, 2009 by Grumpy Hippo

Comment deleted

Comment #2

Posted on Oct 1, 2009 by Grumpy Hippo

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

Thanks.

Status: Fixed

Labels:
Type-Defect Priority-Medium