|
|
@@ -119,19 +119,19 @@ this.docHelper = this.docHelper || (() => {
|
|
|
elementHidden = ascendantHidden || testHiddenElement(element, computedStyle);
|
|
|
}
|
|
|
if (!elementHidden) {
|
|
|
- if (options.compressHTML) {
|
|
|
- const whiteSpace = computedStyle.getPropertyValue("white-space");
|
|
|
- if (whiteSpace.startsWith("pre")) {
|
|
|
- element.setAttribute(PRESERVED_SPACE_ELEMENT_ATTRIBUTE_NAME, "");
|
|
|
+ if (options.compressHTML) {
|
|
|
+ const whiteSpace = computedStyle.getPropertyValue("white-space");
|
|
|
+ if (whiteSpace.startsWith("pre")) {
|
|
|
+ element.setAttribute(PRESERVED_SPACE_ELEMENT_ATTRIBUTE_NAME, "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (options.removeUnusedFonts) {
|
|
|
+ getUsedFont(computedStyle, options, data.usedFonts);
|
|
|
+ getUsedFont(win.getComputedStyle(element, ":first-letter"), options, data.usedFonts);
|
|
|
+ getUsedFont(win.getComputedStyle(element, ":before"), options, data.usedFonts);
|
|
|
+ getUsedFont(win.getComputedStyle(element, ":after"), options, data.usedFonts);
|
|
|
}
|
|
|
}
|
|
|
- if (options.removeUnusedFonts) {
|
|
|
- getUsedFont(computedStyle, options, data.usedFonts);
|
|
|
- getUsedFont(win.getComputedStyle(element, ":first-letter"), options, data.usedFonts);
|
|
|
- getUsedFont(win.getComputedStyle(element, ":before"), options, data.usedFonts);
|
|
|
- getUsedFont(win.getComputedStyle(element, ":after"), options, data.usedFonts);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
getResourcesInfo(win, doc, element, options, data, elementHidden);
|
|
|
if (element.shadowRoot) {
|
|
|
@@ -195,11 +195,8 @@ this.docHelper = this.docHelper || (() => {
|
|
|
}
|
|
|
}
|
|
|
if (element.tagName == "IFRAME") {
|
|
|
- if (element.getBoundingClientRect) {
|
|
|
- const boundingRect = element.getBoundingClientRect();
|
|
|
- if (element.hidden || element.style.display == "none" || boundingRect.width <= 1 && boundingRect.height <= 1) {
|
|
|
- element.setAttribute(REMOVED_CONTENT_ATTRIBUTE_NAME, "");
|
|
|
- }
|
|
|
+ if (elementHidden) {
|
|
|
+ element.setAttribute("src", "data:text/html,");
|
|
|
}
|
|
|
}
|
|
|
}
|