Skip to content

Commit

Permalink
improve localStorage matching
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Oct 10, 2022
1 parent f26ca3e commit 6913717
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/scriptlets/trusted-click-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ export function trustedClickElement(source, selectors, extraMatch = '', delay =

if (localStorageMatch.length > 0) {
const localStorageMatched = localStorageMatch
.every((str) => window.localStorage.getItem(str));
.every((str) => {
const itemValue = window.localStorage.getItem(str);
return itemValue || itemValue === '';
});
if (!localStorageMatched) {
return;
}
Expand All @@ -128,13 +131,6 @@ export function trustedClickElement(source, selectors, extraMatch = '', delay =
.split(COMMON_DELIMITER)
.map((selector) => selector.trim());

/**
* Array of element objects to keep found elements until they are eligible
* to being clicked by delay and/or click order and allow skipping clicked elements
*
* Elements objects should not be removed from array to keep track
* of their order and clicked 'state'
*/
const createElementObj = (element) => {
return {
element: element || null,
Expand Down

0 comments on commit 6913717

Please sign in to comment.