&amp; should be reversed last (to correctly transform "&amp;lt;" to "&lt;" and not to "<")

This commit is contained in:
Denis Ryabov 2015-03-08 20:46:35 +03:00
parent 6ca9151eb2
commit cd06996b62

View File

@ -342,10 +342,10 @@ function escapeHtmlEntities(str) {
function reverseHtmlEntities(str) {
return str
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&quot;/g, '"')
.replace(/&apos;/g, "'");
.replace(/&apos;/g, "'")
.replace(/&amp;/g, '&');
}