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.

Forbid jQuery `is` and fix issues (#30016)

Tested all functionality.

---------

Co-authored-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit 0a2f973de9b681a472c96bdfcd945978e88458d8)

authored by

silverwind
Yarden Shoham
and committed by
Earl Warren
e28f4328 c5eae64e

+9 -9
+2 -2
.eslintrc.yaml
··· 303 303 jquery/no-in-array: [2] 304 304 jquery/no-is-array: [2] 305 305 jquery/no-is-function: [2] 306 - jquery/no-is: [0] 306 + jquery/no-is: [2] 307 307 jquery/no-load: [2] 308 308 jquery/no-map: [2] 309 309 jquery/no-merge: [2] ··· 440 440 no-jquery/no-is-numeric: [2] 441 441 no-jquery/no-is-plain-object: [2] 442 442 no-jquery/no-is-window: [2] 443 - no-jquery/no-is: [0] 443 + no-jquery/no-is: [2] 444 444 no-jquery/no-jquery-constructor: [0] 445 445 no-jquery/no-live: [2] 446 446 no-jquery/no-load-shorthand: [2]
+2 -2
web_src/js/features/admin/common.js
··· 84 84 hideElem($('.oauth2_use_custom_url_field')); 85 85 $('.oauth2_use_custom_url_field input[required]').removeAttr('required'); 86 86 87 - if ($('#oauth2_use_custom_url').is(':checked')) { 87 + if (document.getElementById('oauth2_use_custom_url')?.checked) { 88 88 for (const custom of ['token_url', 'auth_url', 'profile_url', 'email_url', 'tenant']) { 89 89 if (applyDefaultValues) { 90 90 $(`#oauth2_${custom}`).val($(`#${provider}_${custom}`).val()); ··· 98 98 } 99 99 100 100 function onEnableLdapGroupsChange() { 101 - toggleElem($('#ldap-group-options'), $('.js-ldap-group-toggle').is(':checked')); 101 + toggleElem($('#ldap-group-options'), $('.js-ldap-group-toggle')[0].checked); 102 102 } 103 103 104 104 // New authentication
+1 -1
web_src/js/features/common-global.js
··· 373 373 374 374 if (attrTargetAttr) { 375 375 $attrTarget[0][attrTargetAttr] = attrib.value; 376 - } else if ($attrTarget.is('input') || $attrTarget.is('textarea')) { 376 + } else if ($attrTarget[0].matches('input, textarea')) { 377 377 $attrTarget.val(attrib.value); // FIXME: add more supports like checkbox 378 378 } else { 379 379 $attrTarget.text(attrib.value); // FIXME: it should be more strict here, only handle div/span/p
+3 -3
web_src/js/features/repo-legacy.js
··· 139 139 140 140 hasUpdateAction = $listMenu.data('action') === 'update'; // Update the var 141 141 142 - const $clickedItem = $(this); 142 + const clickedItem = this; // eslint-disable-line unicorn/no-this-assignment 143 143 const scope = $(this).attr('data-scope'); 144 144 145 145 $(this).parent().find('.item').each(function () { ··· 148 148 if ($(this).attr('data-scope') !== scope) { 149 149 return true; 150 150 } 151 - if (!$(this).is($clickedItem) && !$(this).hasClass('checked')) { 151 + if (this !== clickedItem && !$(this).hasClass('checked')) { 152 152 return true; 153 153 } 154 - } else if (!$(this).is($clickedItem)) { 154 + } else if (this !== clickedItem) { 155 155 // Toggle for other labels 156 156 return true; 157 157 }
+1 -1
web_src/js/modules/fomantic/dropdown.js
··· 199 199 if (!$item) $item = $menu.find('> .item.selected'); // when dropdown filters items by input, there is no "value", so query the "selected" item 200 200 // if the selected item is clickable, then trigger the click event. 201 201 // 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(); 203 203 } 204 204 }); 205 205