diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-06-18 23:23:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-18 17:23:18 +0200 |
commit | 695f5d170bc60909a50d8a16047b1df3e3c1016d (patch) | |
tree | 84e61414fd4c18495aecc631b8e0e2bd91bb0f53 /web_src/js | |
parent | 1ea6b8fd767f5378075de1097c1c1044a7696cd7 (diff) | |
download | gitea-695f5d170bc60909a50d8a16047b1df3e3c1016d.tar.gz gitea-695f5d170bc60909a50d8a16047b1df3e3c1016d.zip |
Fix incorrect link-action event target (#25306)
A regression of #25210
The `e.target` is not "this", eg: `<button link-action><svg></button>`,
then `this` should be `button` but `e.target` is `svg`.
I will propose a clearer and complete solution for these "link-action"
"show-modal" elements after #24724
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/features/common-global.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index c5f973f31c..b6e1790a90 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -268,10 +268,10 @@ function linkAction(e) { e.preventDefault(); // A "link-action" can post AJAX request to its "data-url" - // Then the browser is redirect to: the "redirect" in response, or "data-redirect" attribute, or current URL by reloading. - // If the "link-action" has "data-modal-confirm(-html)" attribute, a confirm modal dialog will be shown before taking action. + // Then the browser is redirected to: the "redirect" in response, or "data-redirect" attribute, or current URL by reloading. + // If the "link-action" has "data-modal-confirm" attribute, a confirm modal dialog will be shown before taking action. - const $this = $(e.target); + const $this = $(this); const redirect = $this.attr('data-redirect'); const doRequest = () => { |