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?