autosize filters only if the width > 0

This commit is contained in:
tophf 2018-07-07 20:47:00 +03:00
parent 796b2b132d
commit 3bb4e0af9f

View File

@ -23,8 +23,9 @@ HTMLSelectElement.prototype.adjustWidth = function () {
singleSelect.style.width = ''; singleSelect.style.width = '';
singleSelect.appendChild(option0.cloneNode(true)); singleSelect.appendChild(option0.cloneNode(true));
parent.replaceChild(singleSelect, this); parent.replaceChild(singleSelect, this);
if (this.style.width !== singleSelect.offsetWidth + 'px') { const w = singleSelect.offsetWidth;
this.style.width = singleSelect.offsetWidth + 'px'; if (w && this.style.width !== w + 'px') {
this.style.width = w + 'px';
} }
parent.replaceChild(this, singleSelect); parent.replaceChild(this, singleSelect);
}; };