voku / HtmlMin

:clamp: HtmlMin: HTML Compressor and Minifier via PHP
MIT License
161 stars 22 forks source link

Incorrect processing before and after<nocompress> tag #56

Open NicolasRoehm opened 4 years ago

NicolasRoehm commented 4 years ago

Hello Lars Moelleken, Thank you for sharing this great library, it's very useful ! :)

What is this feature about (expected vs actual behaviour)?

HtmlMin doesn't work properly when using <nocompress></nocompress> tag.

How can I reproduce it?

use voku\helper\HtmlMin;

$html = "
<html>
  \r\n\t
  <body>
    <ul style=''>
      <li style='display: inline;' class='foo'>
        \xc3\xa0
      </li>
      <nocompress><!-- Protect me --></nocompress>
      <li class='foo' style='display: inline;'>
        \xc3\xa1
      </li>
      <!-- Remove me -->
    </ul>
  </body>
  \r\n\t
</html>
";
$htmlMin = new HtmlMin();

echo $htmlMin->minify($html);

This code returns

<html><body><ul><li style="display: inline;" class="foo">
            à
          </li>
          <nocompress><!-- Protect me --></nocompress>
          <li class="foo" style="display: inline;">
            á
          </li>
          <!-- Remove me --></ul>

Does it take minutes, hours or days to fix?

I don't know

Any additional information?

The code should return

<html><body><ul><li class=foo style="display: inline;"> à <!-- Protect me --><li class=foo style="display: inline;"> á </ul>

or at least

<html><body><ul><li class=foo style="display: inline;"> à <nocompress><!-- Protect me --></nocompress><li class=foo style="display: inline;"> á </ul>
issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.84. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.