Kaynağa Gözat

prevent unneeded code to run if the element is hidden

Gildas 6 yıl önce
ebeveyn
işleme
b54b28c610
1 değiştirilmiş dosya ile 2 ekleme ve 0 silme
  1. 2 0
      lib/single-file/util/doc-helper.js

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

@@ -118,6 +118,7 @@ this.docHelper = this.docHelper || (() => {
 					}
 					elementHidden = ascendantHidden || testHiddenElement(element, computedStyle);
 				}
+				if (!elementHidden) {
 				if (options.compressHTML) {
 					const whiteSpace = computedStyle.getPropertyValue("white-space");
 					if (whiteSpace.startsWith("pre")) {
@@ -131,6 +132,7 @@ this.docHelper = this.docHelper || (() => {
 					getUsedFont(win.getComputedStyle(element, ":after"), options, data.usedFonts);
 				}
 			}
+			}
 			getResourcesInfo(win, doc, element, options, data, elementHidden);
 			if (element.shadowRoot) {
 				const shadowRootInfo = {};