Skip to content

collapseWhitespace remove the space around the <output> tag #1070

Open

Description

@epexa

how to reproduce:

  1. create example html file "input.html":
<!-- It's not ok! Removes space before and after number 23 -->
<p>Before output tag text <output>23</output> after output tag text.</p>
<!-- It's ok -->
<p>Before b tag text <b>23</b> after b tag text.</p>
  1. run with collapseWhitespace parameter
    npx html-minifier --collapse-whitespace input.html -o output.html

html result "output.html":

<!-- It's not ok! Removes space before and after number 23 --><p>Before output tag text<output>23</output>after output tag text.</p><!-- It's ok --><p>Before b tag text <b>23</b> after b tag text.</p>

reason: the "output" is not a inline tag, but is often used as a inline (for javascript).

Activity

  1. added a commit that references this issue on Aug 10, 2020
  2. j9t commented on Sep 20, 2025

    @j9t
    Collaborator

    (Just to make it easier for others, this was fixed in html-minifier-terser and, consequentially, html-minifier-next.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions