Преглед изворни кода

ignore errors when trying to retrieve CSS content from CSSOM

Gildas пре 7 година
родитељ
комит
ba83cdef80
1 измењених фајлова са 6 додато и 2 уклоњено
  1. 6 2
      lib/single-file/doc-helper.js

+ 6 - 2
lib/single-file/doc-helper.js

@@ -109,8 +109,12 @@ this.docHelper = this.docHelper || (() => {
 	function getStylesheetContents(doc) {
 		if (doc) {
 			const textData = [];
-			doc.querySelectorAll("style").forEach(styleElement => textData.push(Array.from(styleElement.sheet.cssRules).map(rule => rule.cssText).join("\n")));
-			return textData;
+			try {
+				doc.querySelectorAll("style").forEach(styleElement => textData.push(Array.from(styleElement.sheet.cssRules).map(rule => rule.cssText).join("\n")));
+				return textData;
+			} catch (error) {
+				/* ignored */
+			}
 		}
 	}