Преглед на файлове

remove frames with no height and no width

Gildas преди 7 години
родител
ревизия
57f94d6433
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  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, "");
 						}
 					});
 				}