Firefox Nightly 62.0a1 (2018-06-18) (64 bity)
Greasemonkey 4.4.0
// ==UserScript==
// @name Unnamed Script 124585
// @version 1
// @grant none
// @include http://kind-clarke-ced7cb.bitballoon.com/
// ==/UserScript==
Element.prototype._attachShadow = Element.prototype.attachShadow;
Element.prototype.attachShadow = function () {
return this._attachShadow( { mode: "open" } );
};
console.log("US work");
Tested page:
http://kind-clarke-ced7cb.bitballoon.com/
<div id="test" style="border: 1px solid silver;">xxx</div>
<div id="info">wait 4 sec...(so that UserScript can load itself
before)</div>
<script>
setTimeout(()=>{
document.querySelector("#test").attachShadow({mode:"closed"}).innerHTML =
"dec";
document.querySelector("#info").innerHTML += `<br/>run:
document.querySelector("#test").attachShadow({mode:"closed"}).innerHTML =
"dec";`;
}, 3000);
setTimeout(()=>{
document.querySelector("#info").innerHTML += `<br/>shadowRoot of
#test is: ${(document.querySelector("#test").shadowRoot)}`;
}, 4000);
</script>
Now this substitution of the attachShadow method simply does not work.
shadowRoot of #test return null but should be `[object ShadowRoot]`,
because UserScript forces it.
What should I do to make it work in greasemonkey?
What should I do to make the application use the substituted method?
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.