From 998ed2a1ccd805acec8f1dae89a9574971b136d5 Mon Sep 17 00:00:00 2001 From: wfjsw Date: Tue, 16 Jan 2024 23:29:25 -0600 Subject: [PATCH] limit the attribute view of observer --- packages/web/src/observers/general/GeneralObserver.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/web/src/observers/general/GeneralObserver.ts b/packages/web/src/observers/general/GeneralObserver.ts index b5ebf0d108..828619b13f 100644 --- a/packages/web/src/observers/general/GeneralObserver.ts +++ b/packages/web/src/observers/general/GeneralObserver.ts @@ -200,9 +200,16 @@ export function GeneralObserver() { handleKeyAttribute(targetElement, true); handleNodes(nodeHandler.handleChildList([targetElement])); + const monitorAttributeList = new Set(); + monitorAttributeList.add(TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE); + Object.values(options.tagAttributes).forEach((attrs) => + attrs.forEach((attr) => monitorAttributeList.add(attr.toLowerCase())) + ); + // then observe for changes observer.observe(targetElement, { attributes: true, + attributeFilter: [...monitorAttributeList], childList: true, subtree: true, characterData: true,