Skip to content

bug: closing tag for </html> misplaced #285

Open
@woodpexer

Description

@woodpexer

issue is

The following block is my input:

<html><hr><br><div style="font-weight:bold;">aaaaaaaa</div>
<div>bbbbbbbbb.</div>
<div>dddddddddd <u>dddd</u> ddddd</div>
</html>

And the following is my output:

<html></html><hr /><br /><div style="font-weight:bold">aaaaaaaa</div>
<div>bbbbbbbbb.</div>
<div>dddddddddd <u>dddd</u> ddddd</div>

Bug

As can be seen at the end of my input the closing tag is being moved by the sanitizer right to its starting tag in the output.

This is my policy

new HtmlPolicyBuilder()
            .allowStandardUrlProtocols()
            .allowElements("a", "hr", "br", "div", "u")
            .allowElements("html")
            .allowStyling()
            .toFactory();

not part of the issue

Just by the way: is it possible to turn off the conversion of single opened tags into closed tags like for example:

  • from <hr> to <hr />
  • from <br> to <br />

Kind regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions