From c3e9b8b6f9b49981c69fc5069d128ffc9cc67639 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 22 Mar 2024 21:56:38 +0200 Subject: [PATCH] Remove jQuery `.attr` from the project page (#30004) - Switched from jQuery `.attr` to plain javascript `.getAttribute` - Tested the issue movement between columns, column background color setting, and column deletion. It all works as before --------- Signed-off-by: Yarden Shoham Co-authored-by: wxiaoguang Co-authored-by: Giteabot (cherry picked from commit 5c91d7920f4aff08768e274269e211e926aa3d36) --- web_src/js/features/repo-projects.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web_src/js/features/repo-projects.js b/web_src/js/features/repo-projects.js index e95d875ec..fc688bb69 100644 --- a/web_src/js/features/repo-projects.js +++ b/web_src/js/features/repo-projects.js @@ -33,7 +33,7 @@ async function moveIssue({item, from, to, oldIndex}) { const columnSorting = { issues: Array.from(columnCards, (card, i) => ({ - issueID: parseInt($(card).attr('data-issue')), + issueID: parseInt(card.getAttribute('data-issue')), sorting: i, })), }; @@ -134,7 +134,7 @@ export function initRepoProject() { if ($projectColorInput.val()) { setLabelColor($projectHeader, $projectColorInput.val()); } - $boardColumn.attr('style', `background: ${$projectColorInput.val()}!important`); + $boardColumn[0].style = `background: ${$projectColorInput.val()} !important`; $('.ui.modal').modal('hide'); } }); @@ -159,9 +159,9 @@ export function initRepoProject() { }); $('.show-delete-project-column-modal').each(function () { - const $deleteColumnModal = $(`${$(this).attr('data-modal')}`); + const $deleteColumnModal = $(`${this.getAttribute('data-modal')}`); const $deleteColumnButton = $deleteColumnModal.find('.actions > .ok.button'); - const deleteUrl = $(this).attr('data-url'); + const deleteUrl = this.getAttribute('data-url'); $deleteColumnButton.on('click', async (e) => { e.preventDefault();