Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1292,8 +1292,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function jsxEmitPreserve(node: JsxElement|JsxSelfClosingElement) {
function emitJsxAttribute(node: JsxAttribute) {
emit(node.name);
write("=");
emit(node.initializer);
if (node.initializer) {
write("=");
emit(node.initializer);
}
}

function emitJsxSpreadAttribute(node: JsxSpreadAttribute) {
Expand Down
7 changes: 7 additions & 0 deletions tests/baselines/reference/jsxEmitAttributeWithPreserve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//// [jsxEmitAttributeWithPreserve.tsx]

declare var React: any;
<foo data/>

//// [jsxEmitAttributeWithPreserve.jsx]
<foo data/>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=== tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx ===

declare var React: any;
>React : Symbol(React, Decl(jsxEmitAttributeWithPreserve.tsx, 1, 11))

<foo data/>
>data : Symbol(unknown)

10 changes: 10 additions & 0 deletions tests/baselines/reference/jsxEmitAttributeWithPreserve.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
=== tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx ===

declare var React: any;
>React : any

<foo data/>
><foo data/> : any
>foo : any
>data : any

6 changes: 3 additions & 3 deletions tests/baselines/reference/jsxInvalidEsprimaTestSuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ a / > ;
< a;
b > ;
b > ;
<a b= c=></a>;
<a b c></a>;
b.c > ;
<a.b c=></a.b>;
<a.b c></a.b>;
c > ;
<a.b.c></a>;
< .a > ;
Expand All @@ -67,7 +67,7 @@ var x = <div>one</div><div>two</div>;;
var x = <div>one</div> /* intervening comment */ /* intervening comment */ <div>two</div>;;
<a>{"str"}}</a>;
<span className="a"/> id="b" />;
<div className=/>>;
<div className/>>;
<div {...props}/>;

<div>stuff</div>...props}>;
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/jsxReactTestSuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ var x = <div attr1={"foo" + "bar"} attr2={"foo" + "bar" +
<Component constructor="foo"/>;
<Namespace.Component />;
<Namespace.DeepNamespace.Component />;
<Component {...x} y={2} z=/>;
<Component {...x} y={2} z/>;
<Component {...this.props} sound="moo"/>;
<font-face />;
<Component x={y}/>;
<x-component />;
<Component {...x}/>;
<Component {...x} y={2}/>;
<Component {...x} y={2} z=/>;
<Component {...x} y={2} z/>;
<Component x={1} {...y}/>;
<Component x={1} y="2" {...z} {...z}><Child /></Component>;
<Component x="1" {...(z = { y: 2 }, z)} z={3}>Text</Component>;
6 changes: 3 additions & 3 deletions tests/baselines/reference/tsxAttributeResolution6.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ declare module JSX {

//// [tsxAttributeResolution6.jsx]
// Error
<test1 s=/>;
<test1 s/>;
<test1 n='true'/>;
<test2 />;
// OK
<test1 n=/>;
<test1 n/>;
<test1 n={false}/>;
<test2 n=/>;
<test2 n/>;
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ x3();
var x4 = <T extends={true}>() => </T>;
x4.isElement;
// This is an element
var x5 = <T extends=>() => </T>;
var x5 = <T extends>() => </T>;
x5.isElement;
4 changes: 4 additions & 0 deletions tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//@jsx: preserve

declare var React: any;
<foo data/>