django-htmlmin icon indicating copy to clipboard operation
django-htmlmin copied to clipboard

Each call to minify <textarea> content deletes first line if empty

Open honi opened this issue 13 years ago • 7 comments

Well, the title says it all, introduce some blank lines in a

honi avatar Oct 11 '11 12:10 honi

Thanks for reporting :)

fsouza avatar Oct 11 '11 13:10 fsouza

The logic to not minify <textarea> is the same for <script>.

This is not desirable:

<script>





$(document).ready(function () {
    alert("bla");
});
</script>

But this might be:

<textarea>





Hello world</textarea>

We should treat these tags separately.

fsouza avatar Oct 11 '11 13:10 fsouza

I'm not able to reproduce this issue.

I've added a automatized test with the given scenario, but the test passes. Could you please help me here? :)

fsouza avatar Jan 14 '12 17:01 fsouza

I believe I'm able to reproduce this now, the test is broken. I will take a look later.

fsouza avatar Jan 17 '13 00:01 fsouza

I actually made the test @fsouza added break, using 'html.parser' instead of 'html5lib'.

bernardobarreto avatar Feb 11 '13 23:02 bernardobarreto

Actually, the test is wrong. Currently, the test is checking whether the line is removed. We should fix the test, and the behavior.

There are seven blank lines in the original file, but six in the minified.

fsouza avatar Feb 12 '13 15:02 fsouza

<script> and <textarea> should not be minified, one is script code not html and could have so many different scripting languages inside it and more, the other should be formatted by the creator of the code.

hrbonz avatar Feb 20 '14 10:02 hrbonz