>From what I can tell, dojo is testing an argument to see whether it has a
method named "call". dojo seems to be assuming that if such a method
exists, then the argument will not be a string.
Then clojurescript seems to be assigning a function named "call" to the
String prototype. And so these two libraries conflict.
I am unsure whether either library is completely to blame. However it seems
fairly clear that dojo does not intend to invoke "call" on a string.
Changing dojo/on.js, line 83, to
if(type.call && (!type instanceof String)){
does fix the problem. I'll check with the dojo folks on making a change
along these lines unless someone can suggest a change to clojurescript.
-Patrick
On Wednesday, November 28, 2012 9:15:11 PM UTC-8, Brian Nelson wrote:
>
> ok. I've had some time to look into this now and have figured out a few
> things.
>
> 1. This is not due to calling the DGrid constructor from clojurescript. It
> occurs even when I call the DGrid constructor from straight javascript
> code. So it doesn't have to do with the clojurescript code calling the
> constructor.
>
> 2. The error goes away if I don't require cljs.core. If cljs.core is
> required then the grid constructor ends up calling back into some code in
> cljs.core, which is where the error occurs.
>
> So I'm a little further down the road but still don't know exactly why
> doing a goog.require("cljs.core") causes cljs.core to receive events from
> the DGrid constructor. Digging in with my javascript debugger and will
> update this as I find out more information.
>
>
>
> On Monday, November 19, 2012 11:15:54 PM UTC-6, Brian Nelson wrote:
>>
>> Hi,
>>
>> I'm brand new to ClojureScript and have been trying to get myself
>> familiarized with it's javascript interop capabilities by implementing
>> the Dojo toolkit tutorials. I've successfully implemented several of
>> the tutorials, but now I've run into something that I can't figure out
>> and am looking for someone to point me in the right direction.
>>
>> I am calling the DGrid(Dojo grid) constructor using the function
>> maingrid
>>
>> (ns couchadmin.core
>> (:use [jayq.util :only [clj->js]])
>> (:require [clojure.browser.repl :as repl]))
>>
>> (defn greet [dom fx]
>> (let [element (.byId dom "greetingcljs")]
>> (set! (. element -innerHTML) "Hello from Dojo using
>> ClojureScript")
>> (.play (.slideTo fx (clj->js {:top 200 :left 200 :node
>> element})))))
>>
>> (defn maingrid [dom grd]
>> (do
>>
>> (grd. (clj->js {:columns (clj->js {:first "First Name"})}) "grid")
>> (js/alert "hello world")))
>>
>> (defn ^:export main []
>> (comment (repl/connect "http://localhost:9000/repl"))
>> (comment (js/require (array "dojo/dom" "dojo/fx" "dojo/domReady!")
>> greet))
>> (js/require (array "dojo/dom" "dgrid/Grid" "dojo/domReady!")
>> maingrid))
>>
>>
>> When the page is loaded the grid is constructed, but afterwards I see
>> the following javascript exception
>>
>> Uncaught Error: No protocol method ILookup.-lookup defined for
>> type object: [object HTMLDivElement]
>>
>> I'm wondering what this message is indicating. Did I call the
>> constructor incorrectly? Is this an incompatibility with Dojo? Do I
>> need to implement ILookup somehow? Any help would be greatly
>> appreciated.
>>
>> Brian
>>
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en