MDL-62756 form: Remove any click handler first.

The handler has the old state variable. Remove any click handler first.
This commit is contained in:
Mirko Otto 2018-12-12 10:12:49 +01:00
parent 33a388eff7
commit 5cfd7a7286
2 changed files with 3 additions and 1 deletions

File diff suppressed because one or more lines are too long

View file

@ -683,6 +683,8 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
} }
var suggestionsElement = $(document.getElementById(state.suggestionsId)); var suggestionsElement = $(document.getElementById(state.suggestionsId));
// Remove any click handler first.
suggestionsElement.parent().prop("onclick", null).off("click");
suggestionsElement.parent().on('click', '[role=option]', function(e) { suggestionsElement.parent().on('click', '[role=option]', function(e) {
var pendingKey = 'form-autocomplete-parent'; var pendingKey = 'form-autocomplete-parent';
M.util.js_pending(pendingKey); M.util.js_pending(pendingKey);