Avoid JavaScript errors for tipsy if no entry point on the page

Bug: T278313
Change-Id: I48011eec9f7d876b914550012cc76e2209fc783c
This commit is contained in:
Niklas Laxström
2021-04-14 11:46:09 +02:00
committed by jenkins-bot
parent 51ec3bc0e6
commit 50b345c83d

View File

@@ -125,6 +125,17 @@
$( '.uls-settings-trigger, .mw-interlanguage-selector' ) : $( '.uls-settings-trigger, .mw-interlanguage-selector' ) :
$( '.uls-trigger' ); $( '.uls-trigger' );
// Fallback if no entry point is present
if ( !$ulsTrigger.length ) {
$ulsTrigger = $( '#pt-preferences' );
}
// Skip tooltip if there is no element to attach the tooltip to.
// It will cause errors otherwise.
if ( !$ulsTrigger.length ) {
return;
}
function hideTipsy() { function hideTipsy() {
ulsPopup.toggle( false ); ulsPopup.toggle( false );
} }