Skip to content

Support to preserve self-closing syntax on non-void HTML elements #257

@vodik

Description

@vodik

When minifying HTML with self-closing non-void elements (e.g., <custom attr="value"/>), the minifier corrupts the output because it treats these as opening tags and looks for closing tags that don't exist.

While I realize that the HTML5 spec says the / should be ignored on non-void HTML elements, in practice many HTML documents (especially those generated by tools or frameworks) use self-closing syntax for custom elements. In our case, this is just another templating mechanism.

I can provide a patch if there's interest - any opinion on if this should be default behaviour or configured?

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