bublejs / buble

https://buble.surge.sh
MIT License
869 stars 67 forks source link

JSX – non-breaking spaces are HTML encoded #217

Closed maranomynet closed 4 years ago

maranomynet commented 4 years ago

Bublé's JSX parser turns all non-breaking space characters into the string  .

/**@jsx h */
<p> </p>

...becomes...

/**@jsx h */
h( 'p', null, "&nbsp;" )

(Playground: https://buble.surge.sh/#%2F**%40jsx%20h%20*%2F%0A%3Cp%3E%C2%A0%3C%2Fp%3E)

This is A) Different from what Babel does, and B) makes it impossible to pass the resulting string straight into HTMLElement#textContent.

P.S. This breaks both Mithril.js and Hyperscript.js https://codesandbox.io/s/priceless-hooks-dxw32?fontsize=14