From d12bf0eb4a54f0013fa6262079053649fbb1cbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Fri, 3 Apr 2015 11:13:53 +0200 Subject: [PATCH] [FIX] web: don't crash when switching views in firefox For some weird reasons, IE and Chrome (or jquery?) bind the global variable 'event' to the last triggered event (I guess). Of course, our code depended on that behavior, but Firefox does not like it and crashes when we try to read the 'event' variable. This fix simply gets the variable as first argument. --- addons/web/static/src/js/view_manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_manager.js b/addons/web/static/src/js/view_manager.js index 4016779009a..5fbfd40f3da 100644 --- a/addons/web/static/src/js/view_manager.js +++ b/addons/web/static/src/js/view_manager.js @@ -234,7 +234,7 @@ var ViewManager = Widget.extend(ControlPanelMixin, { }); // Add onclick event listener - this.control_elements.$switch_buttons.siblings('button').click(function() { + this.control_elements.$switch_buttons.siblings('button').click(function(event) { var view_type = $(event.target).data('view-type'); self.switch_mode(view_type); });