XML entities should be escaped globally!

This commit is contained in:
Tim de Koning 2012-06-07 15:24:00 +02:00
parent bb389e4723
commit a64ae3d9eb

View file

@ -37,11 +37,11 @@ function capitalize(string) {
}
function escapeXml(string) {
return string.replace('&', '&')
.replace('"', '"')
.replace("'", ''')
.replace("<", '&lt;')
.replace(">", '&gt;');
return string.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
/** @namespace */