aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYarden Shoham <git@yardenshoham.com>2024-03-20 02:09:52 +0200
committerGitHub <noreply@github.com>2024-03-20 00:09:52 +0000
commitadc61c5d71651acc316bbc3a7fee6f2c0c60b06e (patch)
tree82e1d7964cafc76fdab6a5efdadb93a3278954a0
parentdd043854ee8963057daa7b835fc700731ae5fb9e (diff)
downloadgitea-adc61c5d71651acc316bbc3a7fee6f2c0c60b06e.tar.gz
gitea-adc61c5d71651acc316bbc3a7fee6f2c0c60b06e.zip
Remove jQuery `.attr` from the user search box (#29919)
- Switched from jQuery `.attr` to plain javascript `.getAttribute` - Tested the user search box and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com>
-rw-r--r--web_src/js/features/comp/SearchUserBox.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/web_src/js/features/comp/SearchUserBox.js b/web_src/js/features/comp/SearchUserBox.js
index 992d4ef020..541052c174 100644
--- a/web_src/js/features/comp/SearchUserBox.js
+++ b/web_src/js/features/comp/SearchUserBox.js
@@ -5,9 +5,12 @@ const {appSubUrl} = window.config;
const looksLikeEmailAddressCheck = /^\S+@\S+$/;
export function initCompSearchUserBox() {
- const $searchUserBox = $('#search-user-box');
- const allowEmailInput = $searchUserBox.attr('data-allow-email') === 'true';
- const allowEmailDescription = $searchUserBox.attr('data-allow-email-description');
+ const searchUserBox = document.getElementById('search-user-box');
+ if (!searchUserBox) return;
+
+ const $searchUserBox = $(searchUserBox);
+ const allowEmailInput = searchUserBox.getAttribute('data-allow-email') === 'true';
+ const allowEmailDescription = searchUserBox.getAttribute('data-allow-email-description') ?? undefined;
$searchUserBox.search({
minCharacters: 2,
apiSettings: {