Commit Graph

3 Commits (7c9823fcbafd591c58331414bf9b7f44010344b1)

Author SHA1 Message Date
Davy Duperron d1191adce6 Fix ampersand in jsx href and src (#1056)
* Add exceptions for html escape usage in href and src attributes.

* Add new test cases.

* Remove useless spaces.

* Do not escape if the parser does not do so.

* Implement a different heuristic for keeping along with the parser.

* Update tests.

* Forgot passing options as param.

* Experimental alternative implementation.

* Remove other function.

* Push test after merge.

* Update getJsXRawValue in order to return the unprocessed raw value.

Latest Babylon version includes a fix that allow us to directly
inject the unprocessed raw value available in the `extra.rawValue`
property of the node. A last transformation is applied by replacing
double quotes to `"` entities.

* Drop unused htmlEscapeInsideDoubleQuote function.

* Move getJSXRawValue function logic to the its only call, drop it.

A simple check is performed to determine if the parser is babylon or
flow via `n.value.extra`. Thus, the corresponding raw value is
extracted. If we are converting a string from single quotes to
double quotes, we need to make sure that double quotes are converted
to ".

* Remove ambiguous comment.

* Add Babylon parser.

* Update test cases accordingly, revert regression introduced previously.
2017-04-08 07:55:50 -07:00
Brian Ng b8a7e5166b Add parens for ConditionalExpression inside JSXSpreadAttribute (#1015) 2017-03-15 18:52:31 -07:00
Brian Ng 860a9fd6d4 Ensure no parens for JSX inside of an ArrayExpression (#895) 2017-03-05 08:56:07 -08:00