Browse Source

call document.appendChild instead of documentElement.appendChild

Gildas 7 years ago
parent
commit
affba5c8f3
3 changed files with 3 additions and 3 deletions
  1. 1 1
      lib/hooks/hooks-frame.js
  2. 1 1
      lib/hooks/hooks.js
  3. 1 1
      lib/lazy/content/content-lazy-loader.js

+ 1 - 1
lib/hooks/hooks-frame.js

@@ -28,7 +28,7 @@ this.hooksFrame = this.hooksFrame || (() => {
 	if (document instanceof HTMLDocument) {
 		const scriptElement = document.createElement("script");
 		scriptElement.textContent = `(${hook.toString()})()`;
-		document.documentElement.appendChild(scriptElement);
+		document.appendChild(scriptElement);
 		scriptElement.remove();
 		addEventListener(NEW_FONT_FACE_EVENT, event => fontFaces.push(event.detail));
 	}

+ 1 - 1
lib/hooks/hooks.js

@@ -25,7 +25,7 @@ this.hooks = this.hooks || (() => {
 	if (document instanceof HTMLDocument) {
 		const scriptElement = document.createElement("script");
 		scriptElement.textContent = `(${hookPushState.toString()})()`;
-		document.documentElement.appendChild(scriptElement);
+		document.appendChild(scriptElement);
 		scriptElement.remove();
 	}
 

+ 1 - 1
lib/lazy/content/content-lazy-loader.js

@@ -81,7 +81,7 @@ this.lazyLoader = this.lazyLoader || (() => {
 	function injectScript(path) {
 		const scriptElement = document.createElement(SCRIPT_TAG_NAME);
 		scriptElement.src = browser.runtime.getURL(path);
-		document.documentElement.appendChild(scriptElement);
+		document.appendChild(scriptElement);
 		scriptElement.onload = () => scriptElement.remove();
 	}