|
|
@@ -102,14 +102,14 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
|
|
|
stylesheets: getStylesheetsData(doc),
|
|
|
images: elementsInfo.images,
|
|
|
posters: elementsInfo.posters,
|
|
|
- usedFonts: Array.from(elementsInfo.usedFonts),
|
|
|
+ usedFonts: Array.from(elementsInfo.usedFonts.values()),
|
|
|
shadowRoots: elementsInfo.shadowRoots,
|
|
|
imports: elementsInfo.imports,
|
|
|
referrer: doc.referrer
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- function getElementsInfo(win, doc, element, options, data = { usedFonts: new Set(), canvases: [], images: [], posters: [], shadowRoots: [], imports: [] }, ascendantHidden) {
|
|
|
+ function getElementsInfo(win, doc, element, options, data = { usedFonts: new Map(), canvases: [], images: [], posters: [], shadowRoots: [], imports: [] }, ascendantHidden) {
|
|
|
const elements = Array.from(element.childNodes).filter(node => node instanceof win.HTMLElement);
|
|
|
elements.forEach(element => {
|
|
|
let elementHidden, computedStyle;
|
|
|
@@ -226,7 +226,8 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
|
|
|
if (!options.loadedFonts || options.loadedFonts.find(font => normalizeFontFamily(font.family) == fontFamilyName && font.style == fontStyle)) {
|
|
|
const fontWeight = getFontWeight(computedStyle.getPropertyValue("font-weight"));
|
|
|
const fontVariant = computedStyle.getPropertyValue("font-variant") || "normal";
|
|
|
- usedFonts.add([fontFamilyName, fontWeight, fontStyle, fontVariant]);
|
|
|
+ const value = [fontFamilyName, fontWeight, fontStyle, fontVariant];
|
|
|
+ usedFonts.set(JSON.stringify(value), [fontFamilyName, fontWeight, fontStyle, fontVariant]);
|
|
|
}
|
|
|
});
|
|
|
}
|