in stringified Text nodes, only escape &, <, >

pull/7738/head
Conduitry 8 years ago
parent 68fd97bf3a
commit e7a98f922b

@ -9,13 +9,11 @@ export function escape(data: string, { onlyEscapeAtSymbol = false } = {}) {
} }
const escaped = { const escaped = {
'"': '&quot;',
"'": '&##39;',
'&': '&amp;', '&': '&amp;',
'<': '&lt;', '<': '&lt;',
'>': '&gt;' '>': '&gt;',
}; };
export function escapeHTML(html) { export function escapeHTML(html) {
return String(html).replace(/["'&<>]/g, match => escaped[match]); return String(html).replace(/[&<>]/g, match => escaped[match]);
} }

Loading…
Cancel
Save