|
|
@@ -74,9 +74,11 @@ this.docHelper = this.docHelper || (() => {
|
|
|
markHiddenCandidates(win, doc.body, elementsInfo, false, markerRemovedContent, new Set(), ignoredTags);
|
|
|
markHiddenElements(win, doc.body, markerRemovedContent);
|
|
|
doc.querySelectorAll("iframe").forEach(element => {
|
|
|
- const boundingRect = element.getBoundingClientRect();
|
|
|
- if (element.hidden || element.style.display == "none" || boundingRect.width <= 1 && boundingRect.height <= 1) {
|
|
|
- element.setAttribute(markerRemovedContent, "");
|
|
|
+ if (element.getBoundingClientRect) {
|
|
|
+ const boundingRect = element.getBoundingClientRect();
|
|
|
+ if (element.hidden || element.style.display == "none" || boundingRect.width <= 1 && boundingRect.height <= 1) {
|
|
|
+ element.setAttribute(markerRemovedContent, "");
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
elementsInfo = new Map(Array.from(elementsInfo).filter(([element]) => element.getAttribute(markerRemovedContent) != ""));
|
|
|
@@ -188,7 +190,7 @@ this.docHelper = this.docHelper || (() => {
|
|
|
let hidden = false;
|
|
|
if (style) {
|
|
|
hidden = style.display == "none";
|
|
|
- if (!hidden && (style.opacity == "0" || style.visibility == "hidden")) {
|
|
|
+ if (!hidden && (style.opacity == "0" || style.visibility == "hidden") && element.getBoundingClientRect) {
|
|
|
const boundingRect = element.getBoundingClientRect();
|
|
|
hidden = !boundingRect.width && !boundingRect.height;
|
|
|
}
|