Comments (6)
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.
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.
The error is because you're trying to merge an paragraph into a div.
from c2.
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.
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.
Deal. Thanks for the help!
from c2.
Related Issues (20)
- Protocol for clj->js conversions. HOT 1
- No license to use HOT 2
- First example on web page looks broken HOT 17
- Hiccup-style vectors only support 2 classes HOT 1
- Cross-browser "matchesSelector" functionality?
- hello-bars demo has doctype issues? HOT 1
- core.matrix support? HOT 3
- endless loop calling (c2.ticks/search [same-number same-number]) HOT 1
- Problem rendering SVG <image> in c2.util/bind! HOT 3
- Compilation error in C2 "0.2.3-SNAPSHOT" HOT 2
- it seems that the documentation link is broken HOT 2
- docs now link back to Keming Labs page HOT 2
- Event.on for multiple elements HOT 5
- Clamp scales
- Percentage scales
- seqable NodeLists HOT 11
- Colors on sunburst example are broken HOT 1
- C2 projects cannot compile with ClojureScript 2138 HOT 2
- cljs compilation errors HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c2.