mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Update observer-helper.js to handle mutations with multiple elements (#2635)
Update observer-helper.js to handle mutations with multiple elements
This commit is contained in:
parent
e842e01cf3
commit
39c86225e3
1 changed files with 6 additions and 5 deletions
|
|
@ -82,11 +82,12 @@ kpxcObserverHelper.initObserver = async function() {
|
|||
kpxcObserverHelper.cacheStyle(mut, styleMutations, mutations.length);
|
||||
|
||||
if (mut.type === 'childList') {
|
||||
if (mut.addedNodes.length > 0) {
|
||||
kpxcObserverHelper.handleObserverAdd(mut.addedNodes[0]);
|
||||
} else if (mut.removedNodes.length > 0) {
|
||||
kpxcObserverHelper.handleObserverRemove(mut.removedNodes[0]);
|
||||
}
|
||||
mut.addedNodes.forEach(function (node) {
|
||||
kpxcObserverHelper.handleObserverAdd(node);
|
||||
});
|
||||
mut.removedNodes.forEach(function (node) {
|
||||
kpxcObserverHelper.handleObserverRemove(node);
|
||||
});
|
||||
} else if (mut.type === 'attributes' && (mut.attributeName === 'class' || mut.attributeName === 'style')) {
|
||||
// Only accept targets with forms
|
||||
const forms = matchesWithNodeName(mut.target, 'FORM')
|
||||
|
|
|
|||
Loading…
Reference in a new issue