loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove jQuery class from the issue author dropdown (#30188)

- Switched from jQuery class functions to plain JavaScript `classList`
- Tested the issue author dropdown functionality and it works as before

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 72a5d3faa8b65042a4fc7525d511d8942a47dafe)

authored by

Yarden Shoham
Giteabot
and committed by
Gergely Nagy
25303b2d 936448e1

+13 -7
+13 -7
web_src/js/features/repo-issue-list.js
··· 6 6 import {showErrorToast} from '../modules/toast.js'; 7 7 import {createSortable} from '../modules/sortable.js'; 8 8 import {DELETE, POST} from '../modules/fetch.js'; 9 + import {parseDom} from '../utils.js'; 9 10 10 11 function initRepoIssueListCheckboxes() { 11 12 const issueSelectAll = document.querySelector('.issue-checkbox-all'); ··· 129 130 const dropdownTemplates = $searchDropdown.dropdown('setting', 'templates'); 130 131 $searchDropdown.dropdown('internal', 'setup', dropdownSetup); 131 132 dropdownSetup.menu = function (values) { 132 - const $menu = $searchDropdown.find('> .menu'); 133 - $menu.find('> .dynamic-item').remove(); // remove old dynamic items 133 + const menu = $searchDropdown.find('> .menu')[0]; 134 + // remove old dynamic items 135 + for (const el of menu.querySelectorAll(':scope > .dynamic-item')) { 136 + el.remove(); 137 + } 134 138 135 139 const newMenuHtml = dropdownTemplates.menu(values, $searchDropdown.dropdown('setting', 'fields'), true /* html */, $searchDropdown.dropdown('setting', 'className')); 136 140 if (newMenuHtml) { 137 - const $newMenuItems = $(newMenuHtml); 138 - $newMenuItems.addClass('dynamic-item'); 141 + const newMenuItems = parseDom(newMenuHtml, 'text/html').querySelectorAll('body > div'); 142 + for (const newMenuItem of newMenuItems) { 143 + newMenuItem.classList.add('dynamic-item'); 144 + } 139 145 const div = document.createElement('div'); 140 146 div.classList.add('divider', 'dynamic-item'); 141 - $menu[0].append(div, ...$newMenuItems); 147 + menu.append(div, ...newMenuItems); 142 148 } 143 149 $searchDropdown.dropdown('refresh'); 144 150 // defer our selection to the next tick, because dropdown will set the selection item after this `menu` function 145 151 setTimeout(() => { 146 - $menu.find('.item.active, .item.selected').removeClass('active selected'); 147 - $menu.find(`.item[data-value="${selectedUserId}"]`).addClass('selected'); 152 + menu.querySelector('.item.active, .item.selected')?.classList.remove('active', 'selected'); 153 + menu.querySelector(`.item[data-value="${selectedUserId}"]`)?.classList.add('selected'); 148 154 }, 0); 149 155 }; 150 156 }