From 077a3ac8447ad56249b0b7da80efec12d8fd4177 Mon Sep 17 00:00:00 2001 From: Amir Aharoni Date: Tue, 17 Nov 2020 10:25:43 +0200 Subject: [PATCH] Make a more specific CSS selector in getLangsWithBadges This should avoid problems with elements that are not real interlanguage links, which may be added by other code, for example user scripts. Bug: T267887 Change-Id: I3f9c618b417363f667a31e9dad335c1aec15b055 --- resources/js/ext.uls.compactlinks.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/js/ext.uls.compactlinks.js b/resources/js/ext.uls.compactlinks.js index 7a10a666..122cd317 100644 --- a/resources/js/ext.uls.compactlinks.js +++ b/resources/js/ext.uls.compactlinks.js @@ -329,11 +329,9 @@ */ CompactInterlanguageList.prototype.getLangsWithBadges = function () { return Array.prototype.map.call( - document.querySelectorAll( '#p-lang [class*="badge"]' ), + document.querySelectorAll( '#p-lang [class*="badge"] a.interlanguage-link-target' ), function ( el ) { - return mw.uls.convertMediaWikiLanguageCodeToULS( - el.querySelector( '.interlanguage-link-target' ).lang - ); + return mw.uls.convertMediaWikiLanguageCodeToULS( el.lang ); } ); };