Skip to content

Commit

Permalink
Fixed access to data- attributes using event.currentTarget. (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed May 20, 2023
1 parent 71fea7d commit 0bf8d0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Sweet Alert2 Asset Change Log

## 1.0.1 under development

- no changes in this release.
- Bug `PR-#8`: Fixed access to `data-` attributes using `event.currentTarget`. (@terabytesoftw)

## 1.0.0 May 15, 2023

Expand Down
14 changes: 7 additions & 7 deletions src/js/sweetalert.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
function sweetAlertClickHandler(event) {
event.preventDefault();

const cancelText = event.target.getAttribute('data-cancel-text') || 'Cancel';
const confirmText = event.target.getAttribute('data-confirm-text') || 'Accept';
const icon = event.target.getAttribute('data-icon') || 'question'; // Valor por defecto: 'question'
const message = event.target.getAttribute('data-message');
const method = event.target.getAttribute('data-method') || 'GET'; // Valor por defecto: 'GET'
const url = event.target.href;
const title = event.target.getAttribute('data-title') || 'Confirmation';
const cancelText = event.currentTarget.getAttribute('data-cancel-text') || 'No';
const confirmText = event.currentTarget.getAttribute('data-confirm-text') || 'Yes';
const icon = event.currentTarget.getAttribute('data-icon') || 'question';
const message = event.currentTarget.getAttribute('data-message');
const method = event.currentTarget.getAttribute('data-method') || 'GET';
const url = event.currentTarget.href;
const title = event.currentTarget.getAttribute('data-title') || 'Confirmation';

Swal.fire(
{
Expand Down

0 comments on commit 0bf8d0c

Please sign in to comment.