Preferences: Resync menulists when their subtrees change

This commit is contained in:
Abe Jellinek 2023-05-19 16:54:32 +03:00
parent ff43d1877e
commit db4a79838b

View file

@ -345,6 +345,17 @@ ${str}
true
);
this._observerSymbols.set(elem, symbol);
if (elem.tagName === 'menulist') {
// Set up an observer to resync if this menulist has items added/removed later
// (If we set elem.value before the corresponding item is added, the label won't be updated when it
// does get added, unless we do this)
new MutationObserver(() => syncFromPref(elem, preference))
.observe(elem, {
childList: true,
subtree: true
});
}
};
let detachFromPreference = (elem) => {