From 39c86225e3fcd926609ca0b5114479c61702b055 Mon Sep 17 00:00:00 2001 From: Mihai Ionut Vilcu Date: Sun, 14 Sep 2025 11:59:19 +0300 Subject: [PATCH] Update observer-helper.js to handle mutations with multiple elements (#2635) Update observer-helper.js to handle mutations with multiple elements --- keepassxc-browser/content/observer-helper.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/keepassxc-browser/content/observer-helper.js b/keepassxc-browser/content/observer-helper.js index 53e825b..8d5fb41 100644 --- a/keepassxc-browser/content/observer-helper.js +++ b/keepassxc-browser/content/observer-helper.js @@ -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')