diff --git a/js/dom.js b/js/dom.js index 8c642244..355335c7 100644 --- a/js/dom.js +++ b/js/dom.js @@ -303,11 +303,18 @@ function setupLivePrefs(ids = prefs.knownKeys.filter(id => $('#' + id))) { 'value'; } + function isSame(el, propName, value) { + return el[propName] === value || + typeof value === 'boolean' && + el.tagName === 'SELECT' && + el[propName] === `${value}`; + } + function updateElement(id, value) { const el = $('#' + id); if (el) { const prop = getPropName(el); - if (el[prop] !== value || forceUpdate) { + if (!isSame(el, prop, value) || forceUpdate) { el[prop] = value; el.dispatchEvent(new Event('change', {bubbles: true})); } diff --git a/js/prefs.js b/js/prefs.js index 4b1a3229..aed66215 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -177,7 +177,6 @@ if (type === 'string') val = String(val); if (type === 'number') val = Number(val) || 0; if (type === 'boolean') val = val === 'true' || val !== 'false' && Boolean(val); - // 'true' and 'false' strings are used by manage.html in `.invert` elements } if (val !== oldValue && !simpleDeepEqual(val, oldValue)) { values[key] = val;