Przeglądaj źródła

use DOMParser#parseFromString instead of document.implementation.createHTMLDocument

Gildas 7 lat temu
rodzic
commit
864ebf3856
1 zmienionych plików z 1 dodań i 4 usunięć
  1. 1 4
      lib/single-file/single-file-browser.js

+ 1 - 4
lib/single-file/single-file-browser.js

@@ -74,10 +74,7 @@ this.SingleFile = (() => {
 	// ---
 	class DOM {
 		static create(pageContent/*, url*/) {
-			const doc = document.implementation.createHTMLDocument();
-			doc.open();
-			doc.write(pageContent);
-			doc.close();
+			const doc = (new DOMParser()).parseFromString(pageContent, "text/html");
 			return {
 				DOMParser,
 				getComputedStyle,