Escape quotes when they appear as HTML entities in JSX text
Fixes #6241
This commit is contained in:
parent
72bb1d3dec
commit
e12855bca0
|
@ -7221,7 +7221,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
// Replace entities like
|
||||
result = result.replace(/&(\w+);/g, function(s: any, m: string) {
|
||||
if (entities[m] !== undefined) {
|
||||
return String.fromCharCode(entities[m]);
|
||||
let ch = String.fromCharCode(entities[m]);
|
||||
// " needs to be escaped
|
||||
return ch === '"' ? '\\"' : ch;
|
||||
}
|
||||
else {
|
||||
return s;
|
||||
|
|
|
@ -8,7 +8,9 @@ declare module JSX {
|
|||
declare var React: any;
|
||||
|
||||
<div>Dot goes here: · ¬AnEntity; </div>;
|
||||
<div>Be careful of "-ed strings!</div>;
|
||||
|
||||
|
||||
//// [file.js]
|
||||
React.createElement("div", null, "Dot goes here: · ¬AnEntity; ");
|
||||
React.createElement("div", null, "Be careful of \"-ed strings!");
|
||||
|
|
|
@ -19,3 +19,7 @@ declare var React: any;
|
|||
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
|
||||
<div>Be careful of "-ed strings!</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
|
||||
|
|
|
@ -20,3 +20,8 @@ declare var React: any;
|
|||
>div : any
|
||||
>div : any
|
||||
|
||||
<div>Be careful of "-ed strings!</div>;
|
||||
><div>Be careful of "-ed strings!</div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
|
|
|
@ -9,3 +9,4 @@ declare module JSX {
|
|||
declare var React: any;
|
||||
|
||||
<div>Dot goes here: · ¬AnEntity; </div>;
|
||||
<div>Be careful of "-ed strings!</div>;
|
||||
|
|
Loading…
Reference in a new issue