您好,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)回复