Explorar o código

remove frames with no height and no width

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
57f94d6433
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      lib/single-file/doc-helper.js

+ 3 - 2
lib/single-file/doc-helper.js

@@ -78,8 +78,9 @@ this.docHelper = this.docHelper || (() => {
 					markHiddenElements(win, doc.body, styles, markerRemovedContent);
 					markBackdropBackground(doc, win, markerRemovedContent);
 					doc.querySelectorAll("iframe").forEach(element => {
-						if (testHiddenElement(element, styles.get(element))) {
-							element.srcdoc = "<html>";
+						const boundingRect = element.getBoundingClientRect();
+						if (!boundingRect.width && !boundingRect.height) {
+							element.setAttribute(markerRemovedContent, "");
 						}
 					});
 				}