diff options
author | Yarden Shoham <git@yardenshoham.com> | 2024-03-25 06:30:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-25 04:30:38 +0000 |
commit | 2e31a2800e1112ee0ab5a8d3c66b0fba2e737870 (patch) | |
tree | 976fa839b9fc85dcae10dcfdcc12758a5f1a9a4b /web_src/js/features | |
parent | 428e05662f4f745fe7fef04ce9218a86aa4f1b6c (diff) | |
download | gitea-2e31a2800e1112ee0ab5a8d3c66b0fba2e737870.tar.gz gitea-2e31a2800e1112ee0ab5a8d3c66b0fba2e737870.zip |
Remove jQuery `.attr` from the reaction selector (#30052)
- Switched from jQuery `attr` to plain javascript `getAttribute`
- Tested the reaction selector and it works as before
Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Diffstat (limited to 'web_src/js/features')
-rw-r--r-- | web_src/js/features/comp/ReactionSelector.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/web_src/js/features/comp/ReactionSelector.js b/web_src/js/features/comp/ReactionSelector.js index 6df4bde069..fc966c3985 100644 --- a/web_src/js/features/comp/ReactionSelector.js +++ b/web_src/js/features/comp/ReactionSelector.js @@ -7,9 +7,9 @@ export function initCompReactionSelector($parent) { if ($(this).hasClass('disabled')) return; - const actionUrl = $(this).closest('[data-action-url]').attr('data-action-url'); - const reactionContent = $(this).attr('data-reaction-content'); - const hasReacted = $(this).closest('.ui.segment.reactions').find(`a[data-reaction-content="${reactionContent}"]`).attr('data-has-reacted') === 'true'; + const actionUrl = this.closest('[data-action-url]')?.getAttribute('data-action-url'); + const reactionContent = this.getAttribute('data-reaction-content'); + const hasReacted = this.closest('.ui.segment.reactions')?.querySelector(`a[data-reaction-content="${reactionContent}"]`)?.getAttribute('data-has-reacted') === 'true'; const res = await POST(`${actionUrl}/${hasReacted ? 'unreact' : 'react'}`, { data: new URLSearchParams({content: reactionContent}), |