Skip to content

Commit 0a2f973

Browse files
Forbid jQuery is and fix issues (#30016)
Tested all functionality. --------- Co-authored-by: Yarden Shoham <git@yardenshoham.com>
1 parent 8d93cea commit 0a2f973

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

.eslintrc.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ rules:
303303
jquery/no-in-array: [2]
304304
jquery/no-is-array: [2]
305305
jquery/no-is-function: [2]
306-
jquery/no-is: [0]
306+
jquery/no-is: [2]
307307
jquery/no-load: [2]
308308
jquery/no-map: [2]
309309
jquery/no-merge: [2]
@@ -440,7 +440,7 @@ rules:
440440
no-jquery/no-is-numeric: [2]
441441
no-jquery/no-is-plain-object: [2]
442442
no-jquery/no-is-window: [2]
443-
no-jquery/no-is: [0]
443+
no-jquery/no-is: [2]
444444
no-jquery/no-jquery-constructor: [0]
445445
no-jquery/no-live: [2]
446446
no-jquery/no-load-shorthand: [2]

web_src/js/features/admin/common.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function initAdminCommon() {
8484
hideElem($('.oauth2_use_custom_url_field'));
8585
$('.oauth2_use_custom_url_field input[required]').removeAttr('required');
8686

87-
if ($('#oauth2_use_custom_url').is(':checked')) {
87+
if (document.getElementById('oauth2_use_custom_url')?.checked) {
8888
for (const custom of ['token_url', 'auth_url', 'profile_url', 'email_url', 'tenant']) {
8989
if (applyDefaultValues) {
9090
$(`#oauth2_${custom}`).val($(`#${provider}_${custom}`).val());
@@ -98,7 +98,7 @@ export function initAdminCommon() {
9898
}
9999

100100
function onEnableLdapGroupsChange() {
101-
toggleElem($('#ldap-group-options'), $('.js-ldap-group-toggle').is(':checked'));
101+
toggleElem($('#ldap-group-options'), $('.js-ldap-group-toggle')[0].checked);
102102
}
103103

104104
// New authentication

web_src/js/features/common-global.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ function initGlobalShowModal() {
373373

374374
if (attrTargetAttr) {
375375
$attrTarget[0][attrTargetAttr] = attrib.value;
376-
} else if ($attrTarget.is('input') || $attrTarget.is('textarea')) {
376+
} else if ($attrTarget[0].matches('input, textarea')) {
377377
$attrTarget.val(attrib.value); // FIXME: add more supports like checkbox
378378
} else {
379379
$attrTarget.text(attrib.value); // FIXME: it should be more strict here, only handle div/span/p

web_src/js/features/repo-legacy.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export function initRepoCommentForm() {
139139

140140
hasUpdateAction = $listMenu.data('action') === 'update'; // Update the var
141141

142-
const $clickedItem = $(this);
142+
const clickedItem = this; // eslint-disable-line unicorn/no-this-assignment
143143
const scope = $(this).attr('data-scope');
144144

145145
$(this).parent().find('.item').each(function () {
@@ -148,10 +148,10 @@ export function initRepoCommentForm() {
148148
if ($(this).attr('data-scope') !== scope) {
149149
return true;
150150
}
151-
if (!$(this).is($clickedItem) && !$(this).hasClass('checked')) {
151+
if (this !== clickedItem && !$(this).hasClass('checked')) {
152152
return true;
153153
}
154-
} else if (!$(this).is($clickedItem)) {
154+
} else if (this !== clickedItem) {
155155
// Toggle for other labels
156156
return true;
157157
}

web_src/js/modules/fomantic/dropdown.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function attachDomEvents($dropdown, $focusable, $menu) {
199199
if (!$item) $item = $menu.find('> .item.selected'); // when dropdown filters items by input, there is no "value", so query the "selected" item
200200
// if the selected item is clickable, then trigger the click event.
201201
// we can not click any item without check, because Fomantic code might also handle the Enter event. that would result in double click.
202-
if ($item && ($item.is('a') || $item.hasClass('js-aria-clickable'))) $item[0].click();
202+
if ($item && ($item[0].matches('a') || $item.hasClass('js-aria-clickable'))) $item[0].click();
203203
}
204204
});
205205

0 commit comments

Comments
 (0)