Explorar el Código

be more tolerant to faults when rertrieving CSS

Gildas hace 7 años
padre
commit
0015a04010
Se han modificado 1 ficheros con 3 adiciones y 7 borrados
  1. 3 7
      lib/single-file/doc-helper.js

+ 3 - 7
lib/single-file/doc-helper.js

@@ -124,15 +124,11 @@ this.docHelper = this.docHelper || (() => {
 					doc.body.appendChild(tempStyleElement);
 					stylesheet = tempStyleElement.sheet;
 					tempStyleElement.remove();
-				} catch (error) {
-					/* ignored */
-				}
-				if (!stylesheet || stylesheet.cssRules.length != styleElement.sheet.cssRules.length) {
-					try {
+					if (!stylesheet || stylesheet.cssRules.length != styleElement.sheet.cssRules.length) {
 						contents[styleIndex] = Array.from(styleElement.sheet.cssRules).map(rule => rule.cssText).join("\n");
-					} catch (error) {
-						/* ignored */
 					}
+				} catch (error) {
+					/* ignored */
 				}
 			});
 			return contents;