mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
Merge branch 'MDL-68196-master' of git://github.com/rezaies/moodle
This commit is contained in:
commit
50dbf7e9c8
2
lib/amd/build/form-autocomplete.min.js
vendored
2
lib/amd/build/form-autocomplete.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -834,6 +834,12 @@ function($, log, str, templates, notification, LoadingIcon) {
|
||||
});
|
||||
// Whenever the input field changes, update the suggestion list.
|
||||
if (options.showSuggestions) {
|
||||
// Store the value of the field as its last value, when the field gains focus.
|
||||
inputElement.on('focus', function(e) {
|
||||
var query = $(e.currentTarget).val();
|
||||
$(e.currentTarget).data('last-value', query);
|
||||
});
|
||||
|
||||
// If this field uses ajax, set it up.
|
||||
if (options.ajax) {
|
||||
require([options.ajax], function(ajaxHandler) {
|
||||
@ -893,7 +899,15 @@ function($, log, str, templates, notification, LoadingIcon) {
|
||||
};
|
||||
|
||||
// Trigger an ajax update after the text field value changes.
|
||||
inputElement.on("input", throttledHandler);
|
||||
inputElement.on('input', function(e) {
|
||||
var query = $(e.currentTarget).val();
|
||||
var last = $(e.currentTarget).data('last-value');
|
||||
// IE11 fires many more input events than required - even when the value has not changed.
|
||||
if (last !== query) {
|
||||
throttledHandler(e);
|
||||
}
|
||||
$(e.currentTarget).data('last-value', query);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
inputElement.on('input', function(e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user