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)
This commit is contained in:
parent
91f8164012
commit
e9b729fc46
|
@ -6,23 +6,23 @@ function isExclusiveScopeName(name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateExclusiveLabelEdit(form) {
|
function updateExclusiveLabelEdit(form) {
|
||||||
const $nameInput = $(`${form} .label-name-input`);
|
const nameInput = document.querySelector(`${form} .label-name-input`);
|
||||||
const $exclusiveField = $(`${form} .label-exclusive-input-field`);
|
const exclusiveField = document.querySelector(`${form} .label-exclusive-input-field`);
|
||||||
const $exclusiveCheckbox = $(`${form} .label-exclusive-input`);
|
const exclusiveCheckbox = document.querySelector(`${form} .label-exclusive-input`);
|
||||||
const $exclusiveWarning = $(`${form} .label-exclusive-warning`);
|
const exclusiveWarning = document.querySelector(`${form} .label-exclusive-warning`);
|
||||||
|
|
||||||
if (isExclusiveScopeName($nameInput.val())) {
|
if (isExclusiveScopeName(nameInput.value)) {
|
||||||
$exclusiveField.removeClass('muted');
|
exclusiveField?.classList.remove('muted');
|
||||||
$exclusiveField.removeAttr('aria-disabled');
|
exclusiveField?.removeAttribute('aria-disabled');
|
||||||
if ($exclusiveCheckbox[0].checked && $exclusiveCheckbox.data('exclusive-warn')) {
|
if (exclusiveCheckbox.checked && exclusiveCheckbox.getAttribute('data-exclusive-warn')) {
|
||||||
$exclusiveWarning.removeClass('tw-hidden');
|
exclusiveWarning?.classList.remove('tw-hidden');
|
||||||
} else {
|
} else {
|
||||||
$exclusiveWarning.addClass('tw-hidden');
|
exclusiveWarning?.classList.add('tw-hidden');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$exclusiveField.addClass('muted');
|
exclusiveField?.classList.add('muted');
|
||||||
$exclusiveField.attr('aria-disabled', 'true');
|
exclusiveField?.setAttribute('aria-disabled', 'true');
|
||||||
$exclusiveWarning.addClass('tw-hidden');
|
exclusiveWarning?.classList.add('tw-hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue