Skip to content
Snippets Groups Projects
Commit cdd05ef5 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

fixes #3471

Closes #3471

Merge request !2366
parent 30752502
No related branches found
No related tags found
No related merge requests found
Pipeline #17528 passed
...@@ -257,24 +257,27 @@ STUDIP.ready(function () { ...@@ -257,24 +257,27 @@ STUDIP.ready(function () {
$('select.nested-select:not(:has(optgroup)):hidden:not(.select2-awaiting)').each(function() { $('select.nested-select:not(:has(optgroup)):hidden:not(.select2-awaiting)').each(function() {
var observer = new window.MutationObserver(function(mutations) { var observer = new window.MutationObserver(function(mutations) {
mutations.forEach(function(mutation) { mutations.forEach(function(mutation) {
if ($('select.select2-awaiting', mutation.target).length > 0) { let targets = Array.from(mutation.target.querySelectorAll('select.select2-awaiting'));
$('select.select2-awaiting', mutation.target) if (mutation.target.matches('select.select2-awaiting')) {
.removeClass('select2-awaiting') targets.push(mutation.target);
.each(function() { }
createSelect2(this); targets = $(targets).filter(':visible');
});
if (targets.length > 0) {
targets.removeClass('select2-awaiting').each(function() {
createSelect2(this);
});
observer.disconnect(); observer.disconnect();
observer = null;
} }
}); });
}); });
observer.observe($(this).closest(':visible')[0], { observer.observe($(this).closest(':visible')[0], {
attributeOldValue: true, attributeOldValue: true,
attributes: true, attributes: true,
attributeFilter: ['style', 'class'], attributeFilter: ['style', 'class', 'hidden'],
characterData: false, characterData: false,
childList: true, childList: true,
subtree: false subtree: true
}); });
$(this).addClass('select2-awaiting'); $(this).addClass('select2-awaiting');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment