Actual Behavior
GM_addElement return null, when parent_node is not in document.
GM_addElement(Node in ShadowRoot, "img", { id: "test1", src: "abc.jpg" })
GM_addElement(Node in iframe, "img", { id: "test2", src: "abc.jpg" })
The IMG element will be inserted normally, but the element id attribute will be reset to default and the return value will be null instead of the successfully inserted element object.
Expected Behavior
When parent_node is not in document, the custom attributes can be written normally and the return value is correct.
Additional context
Actual Behavior
GM_addElementreturnnull, when parent_node is not indocument.The
IMGelement will be inserted normally, but the element id attribute will be reset to default and the return value will benullinstead of the successfully inserted element object.Expected Behavior
When parent_node is not in
document, the custom attributes can be written normally and the return value is correct.Additional context
TypeError: Illegal invocationwhen inserting an element from parent into a same-origin frame #2313.