Skip to content

Commit

Permalink
Merge pull request #163 from palcarazm/fix/156
Browse files Browse the repository at this point in the history
fix: Added non-passive event support
  • Loading branch information
palcarazm committed Apr 21, 2024
2 parents 245e796 + f25c024 commit 8cdb49c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 7 additions & 4 deletions js/bootstrap5-toggle.ecmas.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,13 @@ function sanitize(text) {
}

// 9: Add listeners
ecmasToggle.addEventListener("touchstart", (e) => {
this.#toggleActionPerformed(e);
});
ecmasToggle.addEventListener(
"touchstart",
(e) => {
this.#toggleActionPerformed(e);
},
{ passive: true }
);
ecmasToggle.addEventListener("click", (e) => {
this.#toggleActionPerformed(e);
});
Expand Down Expand Up @@ -361,7 +365,6 @@ function sanitize(text) {
} else {
this.toggle();
}
e.preventDefault();
}

toggle(silent = false) {
Expand Down
1 change: 0 additions & 1 deletion js/bootstrap5-toggle.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ function sanitize(text) {
} else {
target.toggle();
}
e.preventDefault();
}

Toggle.prototype.toggle = function (silent = false) {
Expand Down

0 comments on commit 8cdb49c

Please sign in to comment.