Entities decoding goes haywire for input values
mderijcke opened this issue · 3 comments
mderijcke commented
Hi there,
We had an input like this:
<input value="T-tag pafssageeapos;s [Month] [Year] <b>test</b>">
That should have looked like:
T-tag pafssagee's [Month] [Year] <b>test</b>
But ended up looking like:
T-tag pafssageeapos;s [Month] [Year] <b>test</b>
DiffHTML seems to (double) encode the ampersands, which it has no business in doing. I fixed it this way:
diff.addTransitionState("attributeChanged", (element, attributeName, oldValue, newValue) => {
if (attributeName === "value") {
$(element).val(entities.decodeHTML(newValue))
}
})
But I have a strong feeling this isn't intended behavior. Maybe something to look into?
tbranyen commented
Absolutely, this is not good business. I'll fix it up and let you know once a new patch release is out.
tbranyen commented
@mderijcke can you test #93 and let me know if it fixes your issue? You can test by using npm to install that commit. if you aren't sure how:
npm install tbranyen/diffhtml#fix-decoding-issue