Skip to content

Commit 9119934

Browse files
authored
Remove jQuery class from the code range selection (#30173)
- Switched from jQuery class functions to plain JavaScript `classList` - Tested the code range selection functionality and it works as before Signed-off-by: Yarden Shoham <[email protected]>
1 parent c9068ef commit 9119934

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

web_src/js/features/repo-code.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ function getLineEls() {
2525
}
2626

2727
function selectRange($linesEls, $selectionEndEl, $selectionStartEls) {
28-
$linesEls.closest('tr').removeClass('active');
28+
for (const el of $linesEls) {
29+
el.closest('tr').classList.remove('active');
30+
}
2931

3032
// add hashchange to permalink
3133
const refInNewIssue = document.querySelector('a.ref-in-new-issue');
@@ -72,7 +74,7 @@ function selectRange($linesEls, $selectionEndEl, $selectionStartEls) {
7274
classes.push(`[rel=L${i}]`);
7375
}
7476
$linesEls.filter(classes.join(',')).each(function () {
75-
$(this).closest('tr').addClass('active');
77+
this.closest('tr').classList.add('active');
7678
});
7779
changeHash(`#L${a}-L${b}`);
7880

@@ -82,7 +84,7 @@ function selectRange($linesEls, $selectionEndEl, $selectionStartEls) {
8284
return;
8385
}
8486
}
85-
$selectionEndEl.closest('tr').addClass('active');
87+
$selectionEndEl[0].closest('tr').classList.add('active');
8688
changeHash(`#${$selectionEndEl[0].getAttribute('rel')}`);
8789

8890
updateIssueHref($selectionEndEl[0].getAttribute('rel'));

0 commit comments

Comments
 (0)