2

I've set up a Backbone Marionette application as follows in my application

CL.Modules.Users = (Users, App, Backbone, Marionette, $, _) ->
  Users.Router = class Router extends CL.AppRouter
    appRoutes:
      'profile' : 'showProfile'

And I have a function showProfile() that takes an argument.

showProfile: (arg1) ->
  alert(arg1)
  arg1.preventDefault() if arg1?

In browsers other than IE8, arg1 is alerted as undefined, but on IE8, it is an empty string (I checked by using typeof). The problem is that arg1? checks to see if event is undefined and so preventDefault() is being called on an empty string on IE8, which is breaking the execution. I'm not sure how this is happening. Any ideas?

Swamy g
  • 2,106
  • 4
  • 23
  • 35
  • This works fine for me. IE8 Win7. You will have to step through the backbone source to find the problem. It is very simple to follow. – Andrew Jul 15 '13 at 18:25
  • Are you sure that showProfile is not called from somewhere else, did you check the stack trace when it is an empty String? – ekeren Nov 26 '13 at 08:26
  • Maybe this can help you: http://stackoverflow.com/questions/1000597/event-preventdefault-function-not-working-in-ie – Dmitry Stratsevsky Jan 17 '14 at 19:15

0 Answers0