Skip to content

Commit a7d0c5d

Browse files
authored
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 <[email protected]>
1 parent 314cd1e commit a7d0c5d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

web_src/js/features/comp/LabelEdit.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ function isExclusiveScopeName(name) {
66
}
77

88
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`);
1313

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');
1919
} else {
20-
$exclusiveWarning.addClass('tw-hidden');
20+
exclusiveWarning?.classList.add('tw-hidden');
2121
}
2222
} 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');
2626
}
2727
}
2828

0 commit comments

Comments
 (0)