Merge "languageButton: Use click method instead of dispatchEvent"

This commit is contained in:
jenkins-bot 2023-06-08 20:35:39 +00:00 committed by Gerrit Code Review
commit aec05c9a37

View file

@ -5,7 +5,9 @@
* has been released and contains this * has been released and contains this
*/ */
function addInterwikiLinkToMainMenu() { function addInterwikiLinkToMainMenu() {
const editLink = document.querySelector( '#p-lang-btn .wbc-editpage' ); const editLink = /** @type {HTMLElement|null} */ (
document.querySelector( '#p-lang-btn .wbc-editpage' )
);
if ( !editLink ) { if ( !editLink ) {
return; return;
@ -26,7 +28,7 @@ function addInterwikiLinkToMainMenu() {
addInterlanguageLink.addEventListener( 'click', function ( /** @type {Event} */ e ) { addInterlanguageLink.addEventListener( 'click', function ( /** @type {Event} */ e ) {
e.preventDefault(); e.preventDefault();
// redirect to the detached and original edit link // redirect to the detached and original edit link
editLink.dispatchEvent( new Event( 'click' ) ); editLink.click();
} ); } );
} }
} }