diff options
author | Yarden Shoham <git@yardenshoham.com> | 2024-03-26 21:57:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 19:57:57 +0000 |
commit | f47e00d9d3c3bd58b5944a29c4ff5cec0357520a (patch) | |
tree | 74a4322c5c651577ba3bc75648b0434eb2e9567b /web_src/js | |
parent | 5687aca4fc9aef44e1fb5af655b2320d18583dbd (diff) | |
download | gitea-f47e00d9d3c3bd58b5944a29c4ff5cec0357520a.tar.gz gitea-f47e00d9d3c3bd58b5944a29c4ff5cec0357520a.zip |
Remove jQuery `.attr` from the Fomantic modal cancel buttons (#30113)
- Switched from jQuery `attr` to plain javascript `setAttribute`
- Tested the modals and they work as before
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/modules/fomantic/modal.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/web_src/js/modules/fomantic/modal.js b/web_src/js/modules/fomantic/modal.js index 7c9aade790..8b455cf4de 100644 --- a/web_src/js/modules/fomantic/modal.js +++ b/web_src/js/modules/fomantic/modal.js @@ -19,7 +19,9 @@ function ariaModalFn(...args) { // In such case, the "Enter" key will trigger the "cancel" button instead of "ok" button, then the dialog will be closed. // It breaks the user experience - the "Enter" key should confirm the dialog and submit the form. // So, all "cancel" buttons without "[type]" must be marked as "type=button". - $(el).find('form button.cancel:not([type])').attr('type', 'button'); + for (const button of el.querySelectorAll('form button.cancel:not([type])')) { + button.setAttribute('type', 'button'); + } } } return ret; |