MDL-51970 autocomplete: Fix for a regression in MDL-51964

This was causing the suggestions list to never open.
Picked up in testing for MDL-51970.
This commit is contained in:
Damyon Wiese 2015-11-04 16:10:00 +08:00
parent 9fe1cb0421
commit 861c1dea98
2 changed files with 5 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -651,16 +651,15 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
inputElement.on('input', function(e) {
var query = $(e.currentTarget).val();
var last = $(e.currentTarget).data('last-value');
if (typeof last === 'undefined') {
last = query;
}
// IE11 fires many more input events than required - even when the value has not changed.
// We need to only do this for real value changed events or the suggestions will be
// unclickable on IE11 (because they will be rebuilt before the click event fires).
if (last != query) {
// Note - because of this we cannot close the list when the query is empty or it will break
// on IE11.
if (last !== query) {
updateSuggestions(options, state, query, originalSelect);
$(e.currentTarget).data('last-value', query);
}
$(e.currentTarget).data('last-value', query);
});
}
};