|
|
|
@ -84,11 +84,11 @@ export function escape(html: string, is_attr = false) {
|
|
|
|
while (pattern.test(html)) {
|
|
|
|
while (pattern.test(html)) {
|
|
|
|
const i = pattern.lastIndex - 1;
|
|
|
|
const i = pattern.lastIndex - 1;
|
|
|
|
const ch = html[i];
|
|
|
|
const ch = html[i];
|
|
|
|
escaped += html.slice(last, i) + (ch === '&' ? '&' : (ch === '"' ? '"' : '<'));
|
|
|
|
escaped += html.substring(last, i) + (ch === '&' ? '&' : (ch === '"' ? '"' : '<'));
|
|
|
|
last = i + 1;
|
|
|
|
last = i + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return escaped + html.slice(last);
|
|
|
|
return escaped + html.substring(last);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function escape_attribute_value(value) {
|
|
|
|
export function escape_attribute_value(value) {
|
|
|
|
|