Skip to content

Commit 2e31a28

Browse files
authored
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 <[email protected]>
1 parent 428e056 commit 2e31a28

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

web_src/js/features/comp/ReactionSelector.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ export function initCompReactionSelector($parent) {
77

88
if ($(this).hasClass('disabled')) return;
99

10-
const actionUrl = $(this).closest('[data-action-url]').attr('data-action-url');
11-
const reactionContent = $(this).attr('data-reaction-content');
12-
const hasReacted = $(this).closest('.ui.segment.reactions').find(`a[data-reaction-content="${reactionContent}"]`).attr('data-has-reacted') === 'true';
10+
const actionUrl = this.closest('[data-action-url]')?.getAttribute('data-action-url');
11+
const reactionContent = this.getAttribute('data-reaction-content');
12+
const hasReacted = this.closest('.ui.segment.reactions')?.querySelector(`a[data-reaction-content="${reactionContent}"]`)?.getAttribute('data-has-reacted') === 'true';
1313

1414
const res = await POST(`${actionUrl}/${hasReacted ? 'unreact' : 'react'}`, {
1515
data: new URLSearchParams({content: reactionContent}),

0 commit comments

Comments
 (0)