您好,Jon (WMF)!歡迎加入維基百科!

感謝您對維基百科的興趣與貢獻,希望您會喜歡這裡。除了歡迎辭以外,也請您了解以下重要文章:

政策
政策
GNU
GNU
版權問題解答
貢獻內容必須是您所著或獲得授權
並同意在CC BY-SA 3.0和GFDL條款下發布
手冊
手冊
問號
問號
有問題?請到互助客棧詢問,或在我的對話頁提出。別忘記:討論後要簽名,方式之一是留下4個波浪紋「 ~~~~ 」。
If you have any questions about the Chinese Wikipedia, please leave a message here. Thank you for visiting!

我是歡迎您的維基人: 木瓜不是食物#留言 2021年5月26日 (三) 03:19 (UTC)回覆

Gadget-Difflink.js

Hi, I saw your modification (Special:Diff/78845882). May I ask if you can trace back to the specific scenario where "element" is null? I have tried all available skins at present, and mw.util.addPortletLink can return a HTMLElement based on the position passed to it.--安憶Talk 2023年9月13日 (三) 02:44 (UTC)回覆

Not all portlets are available in all skins / on all pages so the method will either return an HTMLElement or null per documentation on https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.util-method-addPortletLink
hope this is helpful!--Jdlrobson留言2023年9月13日 (三) 04:25 (UTC)回覆
Checking the logs the error was occurring on the following pages (old revisions in Minerv mobile skin):
--Jon (WMF)留言2023年9月13日 (三) 05:20 (UTC)回覆
Please refer to L-29 and L-34. document.getElementById('p-tb') can successfully obtain a HTMLUListElement. I think that at this point, mw.util.addPortletLink can return a HTMLElement. What are your thoughts on this?--安憶Talk 2023年9月13日 (三) 10:38 (UTC)回覆
Minerva doesn't always have a #p-tb element. It is only present if you enable the "Advanced mode" in settings. You can also see this in an incognito window.--Jon (WMF)留言2023年9月13日 (三) 15:46 (UTC)回覆
I have reproduced it. More precisely, non-logged-in users don't have the #p-tb element, while logged-in users have whether "Advanced mode" is enabled or not. Thanks.--安憶Talk 2023年9月14日 (四) 06:37 (UTC)回覆