From 193de9fcdfca38a8f3741e474d866ca1557d1afa Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 11 May 2018 14:50:44 -0400 Subject: [PATCH] ignore certain inline elements in MutationObserver --- src/content/notificationBar.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/content/notificationBar.ts b/src/content/notificationBar.ts index 4299c23788..79fad3cb80 100644 --- a/src/content/notificationBar.ts +++ b/src/content/notificationBar.ts @@ -8,6 +8,7 @@ document.addEventListener('DOMContentLoaded', (event) => { let barType: string = null; let pageHref: string = null; let observer: MutationObserver = null; + const observeIgnoredElements = new Set(['a', 'i', 'b', 'strong', 'span', 'code', 'br', 'img', 'small', 'em', 'hr']); let domObservationCollectTimeout: number = null; let collectIfNeededTimeout: number = null; let observeDomTimeout: number = null; @@ -121,13 +122,15 @@ document.addEventListener('DOMContentLoaded', (event) => { continue; } - if (addedNode.tagName != null && addedNode.tagName.toLowerCase() === 'form' && + const tagName = addedNode.tagName != null ? addedNode.tagName.toLowerCase() : null; + if (tagName != null && tagName === 'form' && (addedNode.dataset == null || !addedNode.dataset.bitwardenWatching)) { doCollect = true; break; } - if (!addedNode.querySelectorAll) { + if ((tagName != null && observeIgnoredElements.has(tagName)) || + addedNode.querySelectorAll == null) { continue; }