Escape quotes when emitting React

This commit is contained in:
Ryan Cavanaugh
2015-10-08 11:28:18 -07:00
parent 0d95d0405c
commit d229ae4be5
5 changed files with 27 additions and 2 deletions

View File

@@ -19,7 +19,11 @@ namespace M {
// and M.React.__spread
var foo;
var spread1 = <div x='' {...foo} y='' />;
// Quotes
var x = <div>This "quote" thing</div>;
}
//// [file.js]
@@ -33,4 +37,6 @@ var M;
// and M.React.__spread
var foo;
var spread1 = M.React.createElement("div", M.React.__spread({x: ''}, foo, {y: ''}));
// Quotes
var x = M.React.createElement("div", null, "This \"quote\" thing");
})(M || (M = {}));

View File

@@ -36,5 +36,12 @@ namespace M {
>x : Symbol(unknown)
>foo : Symbol(foo, Decl(react-consumer.tsx, 7, 4))
>y : Symbol(unknown)
// Quotes
var x = <div>This "quote" thing</div>;
>x : Symbol(x, Decl(react-consumer.tsx, 11, 4))
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 2, 22))
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 2, 22))
}

View File

@@ -37,5 +37,13 @@ namespace M {
>x : any
>foo : any
>y : any
// Quotes
var x = <div>This "quote" thing</div>;
>x : JSX.Element
><div>This "quote" thing</div> : JSX.Element
>div : any
>div : any
}

View File

@@ -19,4 +19,8 @@ namespace M {
// and M.React.__spread
var foo;
var spread1 = <div x='' {...foo} y='' />;
// Quotes
var x = <div>This "quote" thing</div>;
}