Added fix to regex for string escape (#23421)

* added fix to escape switch

* added fix to regex
This commit is contained in:
Alex Ma
2023-06-19 17:36:34 -07:00
committed by GitHub
parent 97bb8ae2a4
commit f36ed0bb02

View File

@@ -8,7 +8,7 @@
* being used e.g. in HTMLElement.innerHTML.
*/
export function escape(html: string): string {
return html.replace(/[<|>|&|"]/g, function (match) {
return html.replace(/[<|>|&|"|\']/g, function (match) {
switch (match) {
case '<': return '&lt;';
case '>': return '&gt;';