html-differ
html-differ copied to clipboard
Self-closing elements should be equivalent
Currently optionally self-closing elements such as images and line breaks are not considered equivalent. E.G.
const differ = require('html-differ')
let lhs = '<div><br></div>'
let rhs = '<div><br /></div>'
let diff = differ.diffHtml(lhs, rhs)
console.log(diff)
// [
// {
// "value": "<div><br"
// },
// {
// "value": "/",
// "added": true
// },
// {
// "value": "></div>"
// }
// ]
For reference Parse5 and htmlparser2 interpret both strings equally. I'm looking into this to see if I can help.