> So I'm assuming that the problem is in the use of .strobj, and there is some
> better way to convert the clojure map to a javascript map that outputs
> symbol style keys rather than string style keys - is there a simple way to
> do that?  Would that fix the problem?

Yeah, outputting symbol style keys fixes the problem. I use a simple
macro that converts key/value pairs into code that constructs a
JavaScript object:

   (js-object :akey "avalue", :anotherkey 123)

Implementation:

   (defmacro js-object [& kvs]
     (let [objname (gensym)
           setter (fn [[k v]] `(set! (. ~objname ~(-> k name symbol))
~v))]
       `(let [~objname (cljs.core/js-obj)]
          ~@(map setter (partition 2 kvs))
          ~objname)))

This works as long as all keys are known at compile time. When you're
dealing with dynamic data, such as serverside generated ClojureScript
data structures, the situation is a bit more problematic and you may
need to use the workaround I mentioned in my previous post.

On a related note, I've been working on a ClojureScript port of
Hiccup, which provides an arguably more Clojure friendly API for
generating HTML than Closure templates: https://github.com/teropa/hiccups

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to