-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GM_addElement 在某些情况下会返回 undefined #334
Comments
有可复现的例子么? |
问题复现方法:
// ==UserScript==
// @name New Userscript
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description try to take over the world!
// @author You
// @match *://*/*
// @grant GM_addElement
// ==/UserScript==
(function() {
'use strict';
setTimeout(()=>console.log(GM_addElement("div")), 1000);
})();
此问题仅发生在ScriptCat上,其他脚本管理器TM,VM均正常。 问题的触发点我从十多个脚本中逐一排查出是 { objs: [MouseEvent.prototype], props: ["clientX", "clientY", "pageX", "pageY", "layerX", "layerY", "offsetX", "offsetY", "screenX", "screenY", "x", "y"] } 只要将这一行注释,或者将其中的 疑问是 ScriptCat 的 GM_addElement() 方法为什么会与 |
为什么要用MouseEvent的 |
@Xia0xia0Xia0 确实换一个不常用的属性更好,当时没考虑到这个 |
GM_addElement() 方法在某些情况下会返回 undefined,这应该是一个非常隐蔽的Bug,我一直没有找到真正触发它的原因。
表现为:元素已经成功插入,但返回值为undefined.
The text was updated successfully, but these errors were encountered: