HtmlMin icon indicating copy to clipboard operation
HtmlMin copied to clipboard

Incorrect processing before and after<nocompress> tag

Open NicolasRoehm opened this issue 3 years ago • 1 comments

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>

NicolasRoehm avatar Sep 25 '20 10:09 NicolasRoehm

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.

issue-label-bot[bot] avatar Sep 25 '20 10:09 issue-label-bot[bot]