Preferences: Resync menulists when their subtrees change
This commit is contained in:
parent
ff43d1877e
commit
db4a79838b
1 changed files with 11 additions and 0 deletions
|
@ -345,6 +345,17 @@ ${str}
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
this._observerSymbols.set(elem, symbol);
|
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) => {
|
let detachFromPreference = (elem) => {
|
||||||
|
|
Loading…
Reference in a new issue