Skip to content

Commit

Permalink
fix the click function of already existing elements in the DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
jellizaveta committed Jul 24, 2024
1 parent 99eb37d commit 7cabd76
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/scriptlets/trusted-click-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -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();
Expand Down

0 comments on commit 7cabd76

Please sign in to comment.