浏览代码

don't mark as hidden head tags

Gildas 5 年之前
父节点
当前提交
4ed79a9ccd
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/single-file/single-file-helper.js

+ 1 - 1
lib/single-file/single-file-helper.js

@@ -156,7 +156,7 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
 			if (!options.autoSaveExternalSave && (options.removeHiddenElements || options.removeUnusedFonts || options.compressHTML)) {
 				computedStyle = win.getComputedStyle(element);
 				if (options.removeHiddenElements) {
-					elementKept = ascendantHidden && KEPT_TAG_NAMES.includes(element.tagName);
+					elementKept = (ascendantHidden || element.closest("html > head")) && KEPT_TAG_NAMES.includes(element.tagName);
 					if (!elementKept) {
 						elementHidden = ascendantHidden || testHiddenElement(element, computedStyle);
 						if (elementHidden) {