From 668527a562593900fc792c9e8b29352947a343b1 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Thu, 4 Apr 2024 10:08:15 +0200 Subject: [PATCH] Avoid repeated initialization when clicking very fast There is potentially a lot of time between when the attribute is checked and when it is finally set. At least the two RessourceLoader modules need to load. This can take a while, even on fast internet connections. Just double clicking with the mouse can trigger the code twice without the attribute being set. The proposed solution is not the only one, but I believe moving this single line is the most trivial one. Bug: T358637 Change-Id: Ic9b99859841439febb83e91f70930e8676a4968a --- resources/js/ext.uls.interface.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/js/ext.uls.interface.js b/resources/js/ext.uls.interface.js index 01e0e256..39761e19 100644 --- a/resources/js/ext.uls.interface.js +++ b/resources/js/ext.uls.interface.js @@ -578,6 +578,7 @@ if ( $target.attr( 'data-uls-loaded' ) ) { return; } + $target.attr( 'data-uls-loaded', true ); ev.preventDefault(); @@ -588,8 +589,6 @@ languageNodes = parent ? parent.querySelectorAll( '.interlanguage-link-target' ) : []; standalone = isUsingStandaloneLanguageButton(); - $target.attr( 'data-uls-loaded', true ); - // Setup click handler for ULS launchULS( $target,