Merge pull request #3792 from toofar/fix/gm_addstyle_earlyload

Greasemonkey: fix early GM_addStyle with fast sites.
Seems to be a working fix, despite noone having clarity on what is the ideal approach.
This commit is contained in:
toofar 2018-04-09 19:11:10 +12:00 committed by GitHub
commit 69d642cab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,11 +100,8 @@
const head = document.getElementsByTagName("head")[0];
if (head === undefined) {
document.onreadystatechange = function() {
if (document.readyState === "interactive") {
document.getElementsByTagName("head")[0].appendChild(oStyle);
}
};
// no head yet, stick it whereever
document.documentElement.appendChild(oStyle);
} else {
head.appendChild(oStyle);
}