simplify adjustWidth and make it work in FF
This commit is contained in:
parent
8b98baba6a
commit
ffeef695fa
|
@ -23,18 +23,17 @@ router.watch({search: ['search', 'searchMode']}, ([search, mode]) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
HTMLSelectElement.prototype.adjustWidth = function () {
|
HTMLSelectElement.prototype.adjustWidth = function () {
|
||||||
const option0 = this.selectedOptions[0];
|
const sel = this.selectedOptions[0];
|
||||||
if (!option0) return;
|
if (!sel) return;
|
||||||
const parent = this.parentNode;
|
const wOld = parseFloat(this.style.width);
|
||||||
const singleSelect = this.cloneNode(false);
|
const opts = [...this];
|
||||||
singleSelect.style.width = '';
|
opts.forEach(opt => opt !== sel && opt.remove());
|
||||||
singleSelect.appendChild(option0.cloneNode(true));
|
this.style.width = '';
|
||||||
parent.replaceChild(singleSelect, this);
|
requestAnimationFrame(() => {
|
||||||
const w = singleSelect.offsetWidth;
|
const w = this.offsetWidth;
|
||||||
if (w && this.style.width !== w + 'px') {
|
if (w && wOld !== w) this.style.width = w + 'px';
|
||||||
this.style.width = w + 'px';
|
this.append(...opts);
|
||||||
}
|
});
|
||||||
parent.replaceChild(this, singleSelect);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function initFilters() {
|
function initFilters() {
|
||||||
|
|
|
@ -1200,10 +1200,6 @@ a:hover {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#reset-filters {
|
|
||||||
margin-top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#filters summary h2 {
|
#filters summary h2 {
|
||||||
margin-left: -2px;
|
margin-left: -2px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user