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 `.attr` from the label edit exclusive checkbox (#30053)

- Switched from jQuery `attr` to plain javascript `getAttribute`
- Tested the label edit exclusive checkbox and it works as before

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit a7d0c5de4c82d8d206f6c5c51f012ee831502f67)

authored by

Yarden Shoham and committed by
Earl Warren
e9b729fc 91f81640

+13 -13
+13 -13
web_src/js/features/comp/LabelEdit.js
··· 6 6 } 7 7 8 8 function updateExclusiveLabelEdit(form) { 9 - const $nameInput = $(`${form} .label-name-input`); 10 - const $exclusiveField = $(`${form} .label-exclusive-input-field`); 11 - const $exclusiveCheckbox = $(`${form} .label-exclusive-input`); 12 - const $exclusiveWarning = $(`${form} .label-exclusive-warning`); 9 + const nameInput = document.querySelector(`${form} .label-name-input`); 10 + const exclusiveField = document.querySelector(`${form} .label-exclusive-input-field`); 11 + const exclusiveCheckbox = document.querySelector(`${form} .label-exclusive-input`); 12 + const exclusiveWarning = document.querySelector(`${form} .label-exclusive-warning`); 13 13 14 - if (isExclusiveScopeName($nameInput.val())) { 15 - $exclusiveField.removeClass('muted'); 16 - $exclusiveField.removeAttr('aria-disabled'); 17 - if ($exclusiveCheckbox[0].checked && $exclusiveCheckbox.data('exclusive-warn')) { 18 - $exclusiveWarning.removeClass('tw-hidden'); 14 + if (isExclusiveScopeName(nameInput.value)) { 15 + exclusiveField?.classList.remove('muted'); 16 + exclusiveField?.removeAttribute('aria-disabled'); 17 + if (exclusiveCheckbox.checked && exclusiveCheckbox.getAttribute('data-exclusive-warn')) { 18 + exclusiveWarning?.classList.remove('tw-hidden'); 19 19 } else { 20 - $exclusiveWarning.addClass('tw-hidden'); 20 + exclusiveWarning?.classList.add('tw-hidden'); 21 21 } 22 22 } else { 23 - $exclusiveField.addClass('muted'); 24 - $exclusiveField.attr('aria-disabled', 'true'); 25 - $exclusiveWarning.addClass('tw-hidden'); 23 + exclusiveField?.classList.add('muted'); 24 + exclusiveField?.setAttribute('aria-disabled', 'true'); 25 + exclusiveWarning?.classList.add('tw-hidden'); 26 26 } 27 27 } 28 28