diff options
author | Yarden Shoham <git@yardenshoham.com> | 2024-03-29 20:08:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-29 18:08:54 +0100 |
commit | 911993429f3bec0ff4440c012b2a8f295673f961 (patch) | |
tree | 34e3968c03f3001aa59cf497d399de981a515e5f /web_src/js/features | |
parent | c9068ef9e410deefa1c3877daf6dfc3c5000fb17 (diff) | |
download | gitea-911993429f3bec0ff4440c012b2a8f295673f961.tar.gz gitea-911993429f3bec0ff4440c012b2a8f295673f961.zip |
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 <git@yardenshoham.com>
Diffstat (limited to 'web_src/js/features')
-rw-r--r-- | web_src/js/features/repo-code.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/web_src/js/features/repo-code.js b/web_src/js/features/repo-code.js index cb5afa8318..63da5f2039 100644 --- a/web_src/js/features/repo-code.js +++ b/web_src/js/features/repo-code.js @@ -25,7 +25,9 @@ function getLineEls() { } function selectRange($linesEls, $selectionEndEl, $selectionStartEls) { - $linesEls.closest('tr').removeClass('active'); + for (const el of $linesEls) { + el.closest('tr').classList.remove('active'); + } // add hashchange to permalink const refInNewIssue = document.querySelector('a.ref-in-new-issue'); @@ -72,7 +74,7 @@ function selectRange($linesEls, $selectionEndEl, $selectionStartEls) { classes.push(`[rel=L${i}]`); } $linesEls.filter(classes.join(',')).each(function () { - $(this).closest('tr').addClass('active'); + this.closest('tr').classList.add('active'); }); changeHash(`#L${a}-L${b}`); @@ -82,7 +84,7 @@ function selectRange($linesEls, $selectionEndEl, $selectionStartEls) { return; } } - $selectionEndEl.closest('tr').addClass('active'); + $selectionEndEl[0].closest('tr').classList.add('active'); changeHash(`#${$selectionEndEl[0].getAttribute('rel')}`); updateIssueHref($selectionEndEl[0].getAttribute('rel')); |