Git Product home page Git Product logo

Comments (6)

lynaghk avatar lynaghk commented on May 18, 2024

Where's the HTML in your toy project?
Do you have a node with ID "content" on the page?
(Make sure you are loading the JS in the page footer, after the HTML has been loaded. Alternatively, use c2.events#onload to fire a function when the browser says it's ready.)

from c2.

aperiodic avatar aperiodic commented on May 18, 2024

The HTML is produced from hiccup in src/clj/c2_cljs_examples/views.clj.
Yes.
Ah, that was it. It's been a while since I've done frontend stuff!

Now, though, I'm running into a different problem when trying that same bind!: the JS throws "Cannot merge $e into node of different type", from the same singult function as before.

from c2.

lynaghk avatar lynaghk commented on May 18, 2024

The error is because you're trying to merge an paragraph into a div.

from c2.

aperiodic avatar aperiodic commented on May 18, 2024

I thought the whole point of bind! was that it would update the DOM to match the hiccup that you feed it. Are there other similar restrictions I should know about? Or am I grossly misunderstanding the point?

from c2.

lynaghk avatar lynaghk commented on May 18, 2024

It'll update element attributes and children (including adding/removing children nodes). The idea, though, is that you're updating the content of a DOM tree---not radically restructuring the DOM tree itself.
In the code above, you are telling Singult to turn one kind of DOM node into another ("turn this cat into a jar of mayonnaise"), which doesn't make a ton of sense.

If you stick to updating attributes and content, you'll be fine.

from c2.

aperiodic avatar aperiodic commented on May 18, 2024

Deal. Thanks for the help!

from c2.

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.