From 7cabd76866de693de97b41cf927e73d15b417ea4 Mon Sep 17 00:00:00 2001 From: jellizaveta Date: Wed, 24 Jul 2024 13:25:06 +0300 Subject: [PATCH] fix the click function of already existing elements in the DOM --- src/scriptlets/trusted-click-element.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/scriptlets/trusted-click-element.ts b/src/scriptlets/trusted-click-element.ts index a4e7be6a4..462251dde 100644 --- a/src/scriptlets/trusted-click-element.ts +++ b/src/scriptlets/trusted-click-element.ts @@ -413,7 +413,7 @@ export function trustedClickElement( /** * Checks if elements are already present in the DOM. - * If elements are found, the observer is disconnected and the elements are clicked. + * If elements are found, they are clicked. * If elements are not found, the observer is initialized. */ const checkInitialElements = () => { @@ -425,9 +425,8 @@ export function trustedClickElement( return !!element; }); if (foundElements) { - // Click previously collected elements and set canClick to true + // Click previously collected elements fulfillAndHandleSelectors(); - canClick = true; } else { // Initialize MutationObserver if elements were not found initially initializeMutationObserver();