Skip to content

Conversation

RSO
Copy link

@RSO RSO commented Jan 11, 2016

Previously the transform would translate

React.createElement("div", null, "\x3C"); 

To

<div><</div>; 

This PR fixes this by translating <> to &lt;&gt;.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\x3C\x3E is how our CJSX compiler ends up outputting to ES5. I'm not sure if I should add support for other ways of writing these characters as well.

@RSO
Copy link
Author

RSO commented Jan 11, 2016

Not sure about the failure, can't reproduce locally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you turn this into to individual regexes? Seems way simpler:

value.replace(/</g, '&lt;').replace(/>/g, '&gt;'); 
@RSO RSO force-pushed the fix-lt-gt-entities branch from d2c3a27 to 74a9f4b Compare January 11, 2016 17:54
@cpojer
Copy link
Member

cpojer commented Jan 11, 2016

thanks! Would you mind rebasing now that I merged your other changes? :)

Remon Oldenbeuving added 2 commits January 12, 2016 09:24
Previously the transform would translate ``` React.createElement("div", null, "\x3C"); ``` To ``` <div><</div>; ``` This PR fixes this by translating `<>` to `&lt;&gt;`.
@RSO RSO force-pushed the fix-lt-gt-entities branch from 74a9f4b to 1cb1027 Compare January 12, 2016 08:24
cpojer added a commit that referenced this pull request Jan 12, 2016
Make sure less-than and great-than characters are properly encoded.
@cpojer cpojer merged commit 166713e into reactjs:master Jan 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants