Skip to content

Commit

Permalink
limit the attribute view of observer
Browse files Browse the repository at this point in the history
  • Loading branch information
wfjsw committed Jan 17, 2024
1 parent ac162ea commit 998ed2a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/web/src/observers/general/GeneralObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,16 @@ export function GeneralObserver() {
handleKeyAttribute(targetElement, true);
handleNodes(nodeHandler.handleChildList([targetElement]));

const monitorAttributeList = new Set<string>();
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,
Expand Down

0 comments on commit 998ed2a

Please sign in to comment.