You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been playing around with react-magic, testing it on a number of different websites. I got one syntax error quite often. I've included a few examples of this error.
How to reproduce For each site I opened up the debug console (in Firefox), and ran this command (taken from the bookmarklet):
changed the title [-]Something bad happened when transforming HTML to JSX. Parse Error: Unexpected token :[/-][+]Handle inline <style>s[/+]on Sep 16, 2015
So #36 fixes internal stylesheets, but the battle against curly braces is still far from over. It's easily handled in <style> tags as we can expect CSS to contain curly braces, but I'm not sure how to best address unpredictable ones. For example, in that star wars page there's an iframe with a name attribute that contains { } which again breaks the JSX parser.
Activity
Daniel15 commentedon Sep 16, 2015
Inline styles should be fine... I'll try to look into this soon and determine what the problem is.
sicks commentedon Sep 16, 2015
Cause looks to be internal stylesheets. Inline styles are being handled correctly the 'JSX way' but internal stylesheets are not.
needs to convert to
(thanks stackoverflow!)
Daniel15 commentedon Sep 16, 2015
Thanks! Sounds like we need custom handling. That can be done :)
(as an aside, using
\to escape newlines doesn't have very good browser support, so it's not really recommended)[-]Something bad happened when transforming HTML to JSX. Parse Error: Unexpected token :[/-][+]Handle inline <style>s[/+]sicks commentedon Sep 16, 2015
We didn't need those newlines anyway!
sicks commentedon Sep 17, 2015
So #36 fixes internal stylesheets, but the battle against curly braces is still far from over. It's easily handled in
<style>tags as we can expect CSS to contain curly braces, but I'm not sure how to best address unpredictable ones. For example, in that star wars page there's an iframe with a name attribute that contains{ }which again breaks the JSX parser.ssorallen commentedon Oct 26, 2015
@Daniel15, can you release a new version on NPM with this fix?
Daniel15 commentedon Oct 27, 2015
@ssorallen Pushed to NPM as 0.2.5 👍
ssorallen commentedon Oct 27, 2015
@Daniel15 💯