vgapp 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -873,6 +873,18 @@ class VGSelect extends BaseModule {
|
|
|
873
873
|
|
|
874
874
|
// Очистка старых опций
|
|
875
875
|
[...select.querySelectorAll('option')].forEach(opt => {
|
|
876
|
+
// Оставляем первый пустой скрытый placeholder:
|
|
877
|
+
// <option value="" selected hidden></option>
|
|
878
|
+
const isFirst = opt === select.options[0];
|
|
879
|
+
const isEmptyValue = (opt.getAttribute('value') ?? '') === '';
|
|
880
|
+
const isEmptyText = (opt.textContent || '').trim() === '';
|
|
881
|
+
const isHidden = opt.hidden === true || opt.hasAttribute('hidden');
|
|
882
|
+
const isSelectedAttr = opt.hasAttribute('selected');
|
|
883
|
+
|
|
884
|
+
if (isFirst && isEmptyValue && isEmptyText && isHidden && isSelectedAttr) {
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
|
|
876
888
|
if (!opt.hasAttribute('data-preserve') && !opt.closest('optgroup[data-preserve]')) {
|
|
877
889
|
opt.remove();
|
|
878
890
|
}
|