瀏覽代碼

retrieve shadowRoot only if the element is visible

Gildas 6 年之前
父節點
當前提交
e6c72a5616
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/single-file/single-file-helper.js

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

@@ -134,7 +134,7 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
 				}
 				}
 			}
 			}
 			getResourcesInfo(win, doc, element, options, data, elementHidden);
 			getResourcesInfo(win, doc, element, options, data, elementHidden);
-			if (element.shadowRoot) {
+			if (element.shadowRoot && !elementHidden) {
 				const shadowRootInfo = {};
 				const shadowRootInfo = {};
 				element.setAttribute(SHADOW_ROOT_ATTRIBUTE_NAME, data.shadowRootsData.length);
 				element.setAttribute(SHADOW_ROOT_ATTRIBUTE_NAME, data.shadowRootsData.length);
 				data.shadowRootsData.push(shadowRootInfo);
 				data.shadowRootsData.push(shadowRootInfo);