فهرست منبع

fix minor regression with hidden elements removal

Gildas 6 سال پیش
والد
کامیت
4a666f3137
1فایلهای تغییر یافته به همراه6 افزوده شده و 5 حذف شده
  1. 6 5
      lib/single-file/util/doc-helper.js

+ 6 - 5
lib/single-file/util/doc-helper.js

@@ -110,11 +110,12 @@ this.docHelper = this.docHelper || (() => {
 					const display = computedStyle.getPropertyValue("display");
 					const opacity = computedStyle.getPropertyValue("opacity");
 					const visibility = computedStyle.getPropertyValue("visibility");
-					if (ascendantHidden && !options.ignoredTags.includes(element.tagName)) {
-						if (elements.length) {
-							const elements = Array.from(element.childNodes).filter(node => node instanceof win.HTMLElement);
-							elements.forEach(element => element.setAttribute(REMOVED_CONTENT_ATTRIBUTE_NAME, ""));
-						}
+					if (ascendantHidden) {
+						Array.from(element.childNodes).filter(node => node instanceof win.HTMLElement).forEach(element => {
+							if (!options.ignoredTags.includes(element.tagName)) {
+								element.setAttribute(REMOVED_CONTENT_ATTRIBUTE_NAME, "");
+							}
+						});
 					}
 					elementHidden = ascendantHidden || testHiddenElement(element, { display, opacity, visibility });
 				}