XHTML <br></br> converted to <br /><br />
eumpek opened this issue · comments
To Reproduce
Step by step instructions to reproduce the behavior:
const sanitizeHtml = require('sanitize-html'); let html = '<br></br>'; sanitizeHtml(html, {allowedTags: ['br']});
Expected behavior
The <br></br>
is a single XHTML line break which is expected to be converted to <br />
.
Describe the bug
The library doesn't consider the case of the <br></br>
as line break and converts it to double line break which is totally unexpected.
Details
Version of Node.js:
12.16.1
In the default options section of the README one of the options set is selfClosingTags
. You could set that option to the same array minus br
to treat that as a normal tag. Presumably you are using the output as XHTML, so you don't need it converted to a single self-closing break tag.