|
@@ -662,7 +662,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
|
|
|
|
|
async processPageResources() {
|
|
async processPageResources() {
|
|
|
const resourcePromises = [
|
|
const resourcePromises = [
|
|
|
- DomProcessorHelper.processAttribute(this.doc, this.doc.querySelectorAll("link[href][rel*=\"icon\"]"), "href", PREFIX_DATA_URI_IMAGE, this.baseURI, this.options, this.batchRequest, false, true),
|
|
|
|
|
|
|
+ DomProcessorHelper.processAttribute(this.doc, this.doc.querySelectorAll("link[href][rel*=\"icon\"]"), "href", "data:", this.baseURI, this.options, this.batchRequest, false, true),
|
|
|
DomProcessorHelper.processAttribute(this.doc, this.doc.querySelectorAll("object[type=\"image/svg+xml\"], object[type=\"image/svg-xml\"]"), "data", PREFIX_DATA_URI_IMAGE_SVG, this.baseURI, this.options, this.batchRequest),
|
|
DomProcessorHelper.processAttribute(this.doc, this.doc.querySelectorAll("object[type=\"image/svg+xml\"], object[type=\"image/svg-xml\"]"), "data", PREFIX_DATA_URI_IMAGE_SVG, this.baseURI, this.options, this.batchRequest),
|
|
|
DomProcessorHelper.processAttribute(this.doc, this.doc.querySelectorAll("img[src], input[src][type=image]"), "src", PREFIX_DATA_URI_IMAGE, this.baseURI, this.options, this.batchRequest, true),
|
|
DomProcessorHelper.processAttribute(this.doc, this.doc.querySelectorAll("img[src], input[src][type=image]"), "src", PREFIX_DATA_URI_IMAGE, this.baseURI, this.options, this.batchRequest, true),
|
|
|
DomProcessorHelper.processAttribute(this.doc, this.doc.querySelectorAll("embed[src*=\".svg\"]"), "src", PREFIX_DATA_URI_IMAGE_SVG, this.baseURI, this.options, this.batchRequest),
|
|
DomProcessorHelper.processAttribute(this.doc, this.doc.querySelectorAll("embed[src*=\".svg\"]"), "src", PREFIX_DATA_URI_IMAGE_SVG, this.baseURI, this.options, this.batchRequest),
|
|
@@ -680,9 +680,13 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
}
|
|
}
|
|
|
await resourcePromises;
|
|
await resourcePromises;
|
|
|
if (this.options.removeAlternativeImages) {
|
|
if (this.options.removeAlternativeImages) {
|
|
|
- const shortcutIcons = Array.from(this.doc.querySelectorAll("link[href][rel=\"icon\"], link[href][rel=\"shortcut icon\"]"));
|
|
|
|
|
- shortcutIcons.sort((linkElement1, linkElement2) => (parseInt(linkElement2.sizes, 10) || 16) - (parseInt(linkElement1.sizes, 10) || 16));
|
|
|
|
|
- const shortcutIcon = shortcutIcons[0];
|
|
|
|
|
|
|
+ let shortcutIcon = findShortcutIcon(Array.from(this.doc.querySelectorAll("link[href][rel=\"icon\"], link[href][rel=\"shortcut icon\"]")));
|
|
|
|
|
+ if (!shortcutIcon) {
|
|
|
|
|
+ shortcutIcon = findShortcutIcon(Array.from(this.doc.querySelectorAll("link[href][rel*=\"icon\"]")));
|
|
|
|
|
+ if (shortcutIcon) {
|
|
|
|
|
+ shortcutIcon.rel = "icon";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (shortcutIcon) {
|
|
if (shortcutIcon) {
|
|
|
this.doc.querySelectorAll("link[href][rel*=\"icon\"]").forEach(linkElement => {
|
|
this.doc.querySelectorAll("link[href][rel*=\"icon\"]").forEach(linkElement => {
|
|
|
if (linkElement != shortcutIcon) {
|
|
if (linkElement != shortcutIcon) {
|
|
@@ -691,6 +695,12 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ function findShortcutIcon(shortcutIcons) {
|
|
|
|
|
+ shortcutIcons = shortcutIcons.filter(linkElement => linkElement.href != EMPTY_IMAGE);
|
|
|
|
|
+ shortcutIcons.sort((linkElement1, linkElement2) => (parseInt(linkElement2.sizes, 10) || 16) - (parseInt(linkElement1.sizes, 10) || 16));
|
|
|
|
|
+ return shortcutIcons[0];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async resolveStylesheetURLs() {
|
|
async resolveStylesheetURLs() {
|