bem / html-differ

Сompares two HTML
http://bem.info/tools/testing/html-differ/
MIT License
211 stars 44 forks source link

Self-closing elements should be equivalent #135

Open i-like-robots opened 8 years ago

i-like-robots commented 8 years ago

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.