Ver código fonte

use index of style element to store stylesheet contents

Gildas 7 anos atrás
pai
commit
d0b15c058b
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      lib/single-file/doc-helper.js

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

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