ClojureScript in IE 9 (does it work?)

307 views
Skip to first unread message

gchristnsn

unread,
Jan 16, 2012, 2:59:19 AM1/16/12
to Clojure
I can't even call `(js/alert "test")' in IE 9, it compiles into:

alert.call(null,"test");

and says: "Invalid calling object" (IE 9 standards mode, in IE 8
standards mode it doesn't recognize the `call' method)

I need `alert' to debug some other glitch which arises in IE 9 (but
all works fine in other browsers), is it by design?

David Powell

unread,
Jan 16, 2012, 5:32:16 AM1/16/12
to clo...@googlegroups.com

The problem is that things like window.alert on IE, are weird built-in
things that aren't actually 'functions' in the javascript sense, in
that they don't have Function as their prototype, so clojurescript's
attempt to .call them fails. I think that this might actually be
permitted behaviour?

So, I'm not sure what the best solution is. As a quick workaround you
could probably write your own myalert function in javascript that just
calls window.alert, and include it at the top of your page -
clojurescript will be able to call js/myalert.

Perhaps clojurescript should have some sort of workaround for making
these built-ins work on IE... Any ideas?

--
Dave

ckirkendall

unread,
Jan 16, 2012, 4:13:15 PM1/16/12
to Clojure
I ran into the same thing with .setTimeout in enfocus. I moved to
using the wrapper function inside the goog library. In the case
of .setTimeout I used goog.async.Delay and for alert maybe you could
use goog.ui.dialog.

http://closure-library.googlecode.com/svn/docs/class_goog_ui_Dialog.html

Creighton Kirkendall

On Jan 16, 5:32 am, David Powell <djpow...@djpowell.net> wrote:
> On Mon, Jan 16, 2012 at 7:59 AM, gchristnsn <gchrist...@gmail.com> wrote:
> > I can't even call `(js/alert "test")' in IE 9, it compiles into:
>
> > alert.call(null,"test");
>
> > and says: "Invalid calling object" (IE 9 standayrds mode, in IE 8

gchristnsn

unread,
Jan 20, 2012, 3:56:26 AM1/20/12
to Clojure
Thanks for the suggestions, I have created a wrapper function and it
works, but it seems, there are more problems.

I use reader/read-string function to parse clojure data structures
sent as POST messages, and it doesn't recognize keywords in IE.
For example, it treats {:status :ok} as {"\uFFFD'status" "\uFFFD'ok"}
(I just found the bug and don't tried to investigate yet).

gchristnsn

unread,
Jan 20, 2012, 4:34:30 AM1/20/12
to Clojure
I just have tried to replace all special characters in core.js to
their escaped equivalents (\uFDD0 for keywords) and it works fine.
But I still not certain where this bug comes from.

David Nolen

unread,
Jan 20, 2012, 9:01:13 AM1/20/12
to clo...@googlegroups.com
It would be helpful if you could investigate the precise problem if there is one and submit a JIRA ticket.
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
Reply all
Reply to author
Forward
0 new messages