Gildas 7 лет назад
Родитель
Сommit
d34e46a726
1 измененных файлов с 8 добавлено и 12 удалено
  1. 8 12
      lib/single-file/doc-helper.js

+ 8 - 12
lib/single-file/doc-helper.js

@@ -60,7 +60,7 @@ this.docHelper = this.docHelper || (() => {
 		if (options.removeHiddenElements) {
 			const markerRemovedContent = removedContentAttributeName(options.sessionId);
 			const markerRemovedCandidate = removedCandidateAttributeName(options.sessionId);
-			let ignoredTags = JSON.parse(JSON.stringify(IGNORED_REMOVED_TAG_NAMES));			
+			let ignoredTags = JSON.parse(JSON.stringify(IGNORED_REMOVED_TAG_NAMES));
 			if (!options.removeScripts) {
 				ignoredTags = ignoredTags.concat("SCRIPT");
 			}
@@ -162,22 +162,18 @@ this.docHelper = this.docHelper || (() => {
 			if (!ignoredTags.includes(element.tagName)) {
 				hidden = element.hidden;
 				if (!hidden) {
-					const elementStyle = element.style;
-					hidden = elementStyle && elementStyle.display == "none";
-					if (!hidden) {
-						const style = win.getComputedStyle(element);
-						if (style) {
-							hidden = style.display == "none";
-							if (!hidden && (style.opacity == "0" || style.visibility == "hidden")) {
-								const boundingRect = element.getBoundingClientRect();
-								hidden = !boundingRect.width && !boundingRect.height;
-							}
+					const style = win.getComputedStyle(element);
+					if (style) {
+						hidden = style.display == "none";
+						if (!hidden && (style.opacity == "0" || style.visibility == "hidden")) {
+							const boundingRect = element.getBoundingClientRect();
+							hidden = !boundingRect.width && !boundingRect.height;
 						}
 					}
 				}
 				cacheElementsHidden.set(element, hidden);
 			}
-			hidden = Boolean(hidden);			
+			hidden = Boolean(hidden);
 		}
 		return hidden;
 	}