Skip to content

JSX: Convert encoded HTML entities in attributes into UTF-8 #10563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
huan086 opened this issue Aug 26, 2016 · 1 comment
Closed

JSX: Convert encoded HTML entities in attributes into UTF-8 #10563

huan086 opened this issue Aug 26, 2016 · 1 comment
Labels
Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter Fixed A PR has been merged for this issue

Comments

@huan086
Copy link

huan086 commented Aug 26, 2016

From #10492

Encountered another difference with babel regarding encoded HTML in attributes:

TypeScript Version: 2.0.0

Code

function MyComponent(props) {
    return (<div>{props.myAttr}</div>);
}

elsewhere:

<MyComponent myAttr="more&hellip;" />

Expected behavior:

Outputs the html

<div>more&hellip;</div>

Actual behavior:

Outputs the html

<div>more&amp;hellip;</div>

Make sure that &# and &#x works too!

Be careful of the following subtlety

<MyComponent myAttr="This is &amp;# encoded, like in HTML. \ has no effect" />
<MyComponent myAttr={"This is \\u encoded, like in JavaScript. & has no effect"} />
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter labels Aug 26, 2016
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 2.1 milestone Aug 26, 2016
@RyanCavanaugh RyanCavanaugh assigned ghost Aug 26, 2016
@ghost
Copy link

ghost commented Sep 8, 2016

Fixed by #10747

@ghost ghost closed this as completed Sep 8, 2016
@ghost ghost added the Fixed A PR has been merged for this issue label Sep 8, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

2 participants