This function is working correctly in Firefox but not IE 11. I believe the culprit is:
event = String(data.model.attributes.eventToRaise);
I know through a bunch of logging (which I removed for presentation here) that I'm getting into the first else branch correctly, but that the comparison to 'AAA' and 'BBB' aren't working correctly in IE. Logging the contents of 'event' in Firefox shows me a string but in IE console it's a pointer. I've tried a few different things (.toString(), "" + event), all of which worked in FF but not IE.
The context is Backbone with Marionette, this function is being called on click events from different places, and the code is supposed to determine which event originated the call.
showPanel: function (data) {
event = String(data.model.attributes.eventToRaise);
if (event === this.lastEvent) {
//do something
}
else {
var view = NaN;
if (event === 'AAA') {
//whatever
}
else if (event === 'BBB') {
//whatever else
}
this.lastEvent = event;
}
edit: 'var event = String(data.model.attributes.eventToRaise);' solved the issue