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