fix 'true' === true check in setupLivePrefs
This commit is contained in:
parent
1308efb8d0
commit
312f444ec7
|
@ -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}));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user