Skip to content

Commit

Permalink
Check if parentNode exist
Browse files Browse the repository at this point in the history
  • Loading branch information
AmauriC committed Dec 3, 2023
1 parent 27176b1 commit cbdb0ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tarteaucitron.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,10 @@ var tarteaucitron = {
var allowBtnsInSite = document.querySelectorAll(".tarteaucitronAllow:not(#tarteaucitronRoot .tarteaucitronAllow)");
for (i = 0; i < allowBtnsInSite.length; i++) {
tarteaucitron.addClickEventToElement(allowBtnsInSite[i], function () {
this.closest('.tac_activate').parentNode.setAttribute("tabindex","-1");
this.closest('.tac_activate').parentNode.focus();
if(this.closest('.tac_activate').parentNode !== null) {
this.closest('.tac_activate').parentNode.setAttribute("tabindex", "-1");
this.closest('.tac_activate').parentNode.focus();
}
});
}

Expand Down

0 comments on commit cbdb0ae

Please sign in to comment.