فهرست منبع

remove hidden elements and unused rules before processing the doc

Gildas 7 سال پیش
والد
کامیت
c1b2f532e7
1فایلهای تغییر یافته به همراه6 افزوده شده و 3 حذف شده
  1. 6 3
      lib/single-file/single-file-core.js

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

@@ -66,6 +66,12 @@ const SingleFileCore = (() => {
 			this.processor.insertFaviconLink();
 			this.processor.resolveHrefs();
 			this.processor.insertSingleFileCommentNode();
+			if (this.options.removeHiddenElements) {
+				this.processor.removeHiddenElements();
+			}
+			if (this.options.removeUnusedCSSRules) {
+				this.processor.removeUnusedCSSRules();
+			}
 			await Promise.all([this.processor.inlineStylesheets(true), this.processor.linkStylesheets()], this.processor.attributeStyles(true));
 			this.pendingPromises = Promise.all([this.processor.inlineStylesheets(), this.processor.attributeStyles(), this.processor.pageResources()]);
 			if (this.onprogress) {
@@ -91,9 +97,6 @@ const SingleFileCore = (() => {
 			if (this.options.removeUnusedCSSRules) {
 				this.processor.removeUnusedCSSRules();
 			}
-			if (this.options.removeHiddenElements) {
-				this.processor.removeHiddenElements();
-			}
 			if (this.onprogress) {
 				this.onprogress({ type: "page-ended", details: { pageURL: this.options.url } });
 			}