Browse Source

use index of style element to store stylesheet contents

Gildas 7 years ago
parent
commit
d0b15c058b
1 changed files with 2 additions and 2 deletions
  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) {
 		if (doc) {
 			const contents = [];
-			doc.querySelectorAll("style").forEach(styleElement => {
+			doc.querySelectorAll("style").forEach((styleElement, styleIndex) => {
 				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) {
 					/* ignored */
 				}