Giter Club home page Giter Club logo

Comments (7)

ckirkendall avatar ckirkendall commented on September 2, 2024

I should be able to test this today. I am very interested in what is happening here as there should be no difference in a form vs a div as long as the id's don't conflict. Does the form have a name element.

from enfocus.

dbushenko avatar dbushenko commented on September 2, 2024

No, it doesn't.

from enfocus.

dbushenko avatar dbushenko commented on September 2, 2024

Also it skips the

    <script> . . . </script> 

elements. Sad. I need scripts in my snippets...

from enfocus.

ckirkendall avatar ckirkendall commented on September 2, 2024

Can you update your web sample with something that reproduce this issue and
the expected result so I can try to reproduce it.

CK

On Wed, Jan 2, 2013 at 7:47 AM, dbushenko [email protected] wrote:

Also it skips the . . . elements. Sad. I need scripts in my snippets...


Reply to this email directly or view it on GitHubhttps://github.com//issues/38#issuecomment-11806838.

from enfocus.

dbushenko avatar dbushenko commented on September 2, 2024

Looks like that might not be a bug, but a feature...

Although this feature is not so convinent to my mind. I have updated my project (https://github.com/dbushenko/websample), please have a look. In main.cljs I create the snippet my-snippet which contains the following html:

<div id="mytest">
  <script type="text/javascript">
alert("Hello, Creig!");
  </script>
  <div id="this">
  </div>
  Hello from Enfocus!
</div>

If you open the file snippets.html in your browser, you will certainly see the popup message. But when I create a snippet from this html and inject that snippet into main.html page, the javascript code is not evaluated. I cannot run any code when the snippet is shown; also I cannot add any definitions. E.g. when I change the js code to the following

  function myfunc() { alert("Hello, Creig!"); }

I still cannot use the function 'myfunc()'.

I don't know whether I have to complain about this issue, probably this behavior is explained by the architecture design.

from enfocus.

ckirkendall avatar ckirkendall commented on September 2, 2024

It is an architectural thing that prevents this but you might be able to get around it. let me think about it for awhile but I was thinking you could have a custom transform that could be run on script tag in the snippet (after you add it to the dom) that would eval that scripts. I have not tried the below snippet but it kind of what I am thinking.

(def evaljs
    (em/trans [node]  (js/eval (.innerHTML node))))

CK

from enfocus.

ckirkendall avatar ckirkendall commented on September 2, 2024

I am closing this issue because its not something we can fix and a work around was found.

from enfocus.

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.