From 772d6605a05eabce97ea8c12fbdfdbd3ce614feb Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 26 Sep 2017 15:27:01 +0200 Subject: [PATCH] Avoid binding click handler multiple times --- api/js/etemplate/et2_widget_dropdown_button.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/et2_widget_dropdown_button.js b/api/js/etemplate/et2_widget_dropdown_button.js index 4a4b795390..3519d7f4fa 100644 --- a/api/js/etemplate/et2_widget_dropdown_button.js +++ b/api/js/etemplate/et2_widget_dropdown_button.js @@ -277,7 +277,6 @@ var et2_dropdown_button = (function(){ "use strict"; return et2_inputWidget.exte * @returns {Boolean} */ click: function(_ev) { - if (this.clicked) return; this.clicked = true; if (!this._super.apply(this, arguments)) @@ -285,7 +284,7 @@ var et2_dropdown_button = (function(){ "use strict"; return et2_inputWidget.exte this.clicked = false; return false; } - + this.clicked = false; return true; }, @@ -299,7 +298,7 @@ var et2_dropdown_button = (function(){ "use strict"; return et2_inputWidget.exte // Move the parent's handler to the button, or we can't tell the difference between the clicks jQuery(this.node).unbind("click.et2_baseWidget"); - this.button.bind("click.et2_baseWidget", this, function(e) { + this.button.off().bind("click.et2_baseWidget", this, function(e) { return e.data.click.call(e.data, this); }); },