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
This commit is contained in:
thiemowmde
2024-04-04 10:08:15 +02:00
committed by jenkins-bot
parent 04a7aeb0f9
commit 668527a562

View File

@@ -578,6 +578,7 @@
if ( $target.attr( 'data-uls-loaded' ) ) { if ( $target.attr( 'data-uls-loaded' ) ) {
return; return;
} }
$target.attr( 'data-uls-loaded', true );
ev.preventDefault(); ev.preventDefault();
@@ -588,8 +589,6 @@
languageNodes = parent ? parent.querySelectorAll( '.interlanguage-link-target' ) : []; languageNodes = parent ? parent.querySelectorAll( '.interlanguage-link-target' ) : [];
standalone = isUsingStandaloneLanguageButton(); standalone = isUsingStandaloneLanguageButton();
$target.attr( 'data-uls-loaded', true );
// Setup click handler for ULS // Setup click handler for ULS
launchULS( launchULS(
$target, $target,