nrepl / weasel

ClojureScript browser REPL using WebSockets
The Unlicense
324 stars 35 forks source link

clojure.browser is not compatible with Nashorn (or old browsers) #20

Closed pleasetrythisathome closed 9 years ago

pleasetrythisathome commented 10 years ago

I'm using nashorn for server rendering, and clojure.browser.events extends js/Element which doesn't exist in Nashorn or older browsers like ie8.

https://github.com/clojure/clojurescript/blob/master/src/cljs/clojure/browser/event.cljs#L33

would it be possible to remove the dependency by using google closure websocket implementation instead? I know it's a somewhat tall request, since you're using clojure.browser for all of your websocket implementation, but the closure api looks pretty consistent. Would you consider a PR if I work on it?

http://docs.closure-library.googlecode.com/git/class_goog_net_WebSocket.html

tomjakubowski commented 10 years ago

Does the Google Closure WebSocket implementation even work on IE8? That would be a pleasant surprise! Btw, we are using the Closure WebSocket implementation, we're just extending it with a few protocol implementations.

The problem is that one of those protocols is in clojure.browser.event as you indicated. I'm definitely open to using a different event protocol if it means compatibility with non-browser and legacy JS environments.

BTW, it might also make sense to contribute a better clojure.browser.event upstream that doesn't rely on js/Element. Better Nashorn support might be pretty convincing to the ClojureScript team!

tomjakubowski commented 10 years ago

(Probably just making the extend-type of js/Element conditional on js/Element being defined would be enough.)

pleasetrythisathome commented 10 years ago

yea i'll submit a patch

tomjakubowski commented 9 years ago

I see clojure.browser.event has some Nashorn support now. Does that resolve this issue or is there work to be done on Weasel still?

pleasetrythisathome commented 9 years ago

yup. problem is resolved