Răsfoiți Sursa

use DOMParser#parseFromString instead of document.implementation.createHTMLDocument

Gildas 7 ani în urmă
părinte
comite
864ebf3856
1 a modificat fișierele cu 1 adăugiri și 4 ștergeri
  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 {
 	class DOM {
 		static create(pageContent/*, url*/) {
 		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 {
 			return {
 				DOMParser,
 				DOMParser,
 				getComputedStyle,
 				getComputedStyle,