Coder Social home page Coder Social logo

HTML -> JSX parser barfs on <script> code about react-magic HOT 15 CLOSED

reactjs avatar reactjs commented on May 2, 2024
HTML -> JSX parser barfs on

Comments (15)

Daniel15 avatar Daniel15 commented on May 2, 2024

Perhaps we should modify HTML to JSX to strip <script> tags.

from react-magic.

KyleAMathews avatar KyleAMathews commented on May 2, 2024

In my case that'd be bad as the <script> tag is loading a 3rd-party widget.

from react-magic.

sntran avatar sntran commented on May 2, 2024

Or even if the page has <script> tag to load custom JS code.

from react-magic.

Daniel15 avatar Daniel15 commented on May 2, 2024

If stripping the tags isn't an option, perhaps react-magic should pull them all out and eval the code. I think this is what other similar libraries do.

from react-magic.

santagada avatar santagada commented on May 2, 2024

Had the same problem with the bookmarklet on all pages that I tried... it seems that it is really hard to find a page without script tags this days.

from react-magic.

Daniel15 avatar Daniel15 commented on May 2, 2024

@santagada or @KyleAMathews - Can you please provide an example of a script that crashes react-magic? I tried adding a script tag to a page but didn't get the Something bad happened error. Thanks!

from react-magic.

santagada avatar santagada commented on May 2, 2024

Try this one: http://metrology.readthedocs.org/en/latest/instruments.html

any readthedocs gives the same error this was just the first one on my history.

from react-magic.

Daniel15 avatar Daniel15 commented on May 2, 2024

The error on that one doesn't appear to be a JavaScript error, it's JSXTransformer not liking some spans that just have = as their content. Filed as facebook/react#2160

from react-magic.

santagada avatar santagada commented on May 2, 2024

it appears to be: facebook/esprima#37

from react-magic.

sahanDissanayake avatar sahanDissanayake commented on May 2, 2024

Whats the status of this issue ?

I'm loving this idea. But cannot implement this to my app as it keeps throwing error at me

Uncaught Error: Something bad happened when transforming HTML to JSX: Error: Parse Error: Line 32: Expected corresponding XJS closing tag for li magic.js:123reactComponentFromHTML magic.js:123render magic.js:138init magic.js:264NODE_TYPE.ELEMENT magic.js:279__webpack_require__ magic.js:30(anonymous function) magic.js:50(anonymous function) magic.js:53webpackUniversalModuleDefinition magic.js:9(anonymous function) magic.js:10

When I fix this issue I get another one. it just keeps going. How to fix this ?

from react-magic.

Daniel15 avatar Daniel15 commented on May 2, 2024

It sounds like you have invalid HTML. What does the W3C validator say when
you validate your site?

Sent from my mobile.
On Sep 16, 2014 4:28 AM, "sahanDissanayake" [email protected]
wrote:

Whats the status of this issue ?

I'm loving this idea. But cannot implement this to my app as it keeps
throwing error at me

Uncaught Error: Something bad happened when transforming HTML to JSX:
Error: Parse Error: Line 32: Expected corresponding XJS closing tag for li
magic.js:123reactComponentFromHTML magic.js:123render magic.js:138init
magic.js:264NODE_TYPE.ELEMENT magic.js:279__webpack_require__
magic.js:30(anonymous function) magic.js:50(anonymous function)
magic.js:53webpackUniversalModuleDefinition magic.js:9(anonymous function)
magic.js:10

When I fix this issue I get another one. it just keeps going. How to fix
this ?

Reply to this email directly or view it on GitHub
#2 (comment).

from react-magic.

sahanDissanayake avatar sahanDissanayake commented on May 2, 2024

I did not check it against W3C validator.

Ok. 306 errors. Jeez. I fill fix my problem first. :)

I will get back to you on this. Good job on this plugin. 👍

from react-magic.

Daniel15 avatar Daniel15 commented on May 2, 2024

Closing this out, I think the issue with script tags was resolved.

from react-magic.

santagada avatar santagada commented on May 2, 2024

it appears that now it is barfing on comments... like:

will open another ticket

from react-magic.

trusktr avatar trusktr commented on May 2, 2024

React is barfing on this:

    render: function() {
        return (
            <div class="gl-map-container">
                <script id="shader-fs" type="x-shader/x-fragment">
                    precision mediump float;

                    void main(void) {
                        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
                    }
                </script>
            </div>
        )
    }

from react-magic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.