Note the following code that works: (defn ^:export displayPlain [id] (let [h (.getElementById window/document id) txt (aget h "innerText")] (window/alert (str "plain " txt)) (aset h "innerText" "here I am!"))) Here, javascript object "h" is treated as array, and I was able to get and set its value (since it is mutable).
Note that the following code doesn't work, since h is not a map, and thus we can't access its properties neither as keywords nor as names. (defn ^:export displayPlain2 [id] (let [h (.getElementById window/document id) ;; txt (get h "innerText") txt (:innerText h)] (window/alert (str "plain " txt)))) This makes dealing with js objects a bit mor verbose than clojure maps. It would be good if Clojure maps and JS object would be interchangeable from ClojureScript code. Would it make sense to open a bug/feature for this? I know that this is doable using closure library, but it would be nice if it could be easily doable using plain objects. (defn ^:export display [id] (let [h (dom/getElement id) txt (dom/getTextContent h)] (window/alert (str "gdom " txt)))) Regards, Marko -- 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