瀏覽代碼

don't override style element contents with empty stylesheets

Gildas 7 年之前
父節點
當前提交
c83fefdc76
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      lib/single-file/single-file-core.js

+ 3 - 1
lib/single-file/single-file-core.js

@@ -465,7 +465,9 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			if (this.options.stylesheetContents) {
 				let indexStyle = 0;
 				this.doc.querySelectorAll("style").forEach(styleElement => {
-					styleElement.textContent = this.options.stylesheetContents[indexStyle];
+					if (this.options.stylesheetContents[indexStyle]) {
+						styleElement.textContent = this.options.stylesheetContents[indexStyle];
+					}
 					indexStyle++;
 				});
 			}