single-file-core 1.0.65 → 1.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/single-file-core.js +14 -11
- package/single-file-mini-helper.js +5 -0
package/package.json
CHANGED
package/single-file-core.js
CHANGED
|
@@ -867,9 +867,9 @@ class Processor {
|
|
|
867
867
|
}
|
|
868
868
|
|
|
869
869
|
saveFavicon() {
|
|
870
|
-
let faviconElement = this.doc.querySelector("link[href][rel=\"icon\"]");
|
|
870
|
+
let faviconElement = this.doc.querySelector("link[href][rel=\"shortcut icon\"]");
|
|
871
871
|
if (!faviconElement) {
|
|
872
|
-
faviconElement = this.doc.querySelector("link[href][rel=\"
|
|
872
|
+
faviconElement = this.doc.querySelector("link[href][rel=\"icon\"]");
|
|
873
873
|
}
|
|
874
874
|
if (!faviconElement) {
|
|
875
875
|
faviconElement = this.doc.createElement("link");
|
|
@@ -1167,6 +1167,13 @@ class Processor {
|
|
|
1167
1167
|
if (shadowRootData) {
|
|
1168
1168
|
const templateElement = doc.createElement("template");
|
|
1169
1169
|
templateElement.setAttribute(SHADOWROOT_ATTRIBUTE_NAME, shadowRootData.mode);
|
|
1170
|
+
if (shadowRootData.adoptedStyleSheets) {
|
|
1171
|
+
shadowRootData.adoptedStyleSheets.forEach(stylesheetContent => {
|
|
1172
|
+
const styleElement = doc.createElement("style");
|
|
1173
|
+
styleElement.textContent = stylesheetContent;
|
|
1174
|
+
templateElement.appendChild(styleElement);
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1170
1177
|
const shadowDoc = util.parseDocContent(shadowRootData.content);
|
|
1171
1178
|
if (shadowDoc.head) {
|
|
1172
1179
|
const metaCharset = shadowDoc.head.querySelector("meta[charset]");
|
|
@@ -1184,13 +1191,6 @@ class Processor {
|
|
|
1184
1191
|
} else {
|
|
1185
1192
|
element.appendChild(templateElement);
|
|
1186
1193
|
}
|
|
1187
|
-
if (shadowRootData.adoptedStyleSheets) {
|
|
1188
|
-
shadowRootData.adoptedStyleSheets.forEach(stylesheetContent => {
|
|
1189
|
-
const styleElement = doc.createElement("style");
|
|
1190
|
-
styleElement.textContent = stylesheetContent;
|
|
1191
|
-
templateElement.appendChild(styleElement);
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
1196
1196
|
});
|
|
@@ -1516,11 +1516,14 @@ class ProcessorHelper {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
|
|
1518
1518
|
static processShortcutIcons(doc) {
|
|
1519
|
-
let shortcutIcon = findShortcutIcon(Array.from(doc.querySelectorAll("link[href][rel=\"
|
|
1519
|
+
let shortcutIcon = findShortcutIcon(Array.from(doc.querySelectorAll("link[href][rel=\"shortcut icon\"]")));
|
|
1520
|
+
if (!shortcutIcon) {
|
|
1521
|
+
shortcutIcon = findShortcutIcon(Array.from(doc.querySelectorAll("link[href][rel=\"icon\"]")));
|
|
1522
|
+
}
|
|
1520
1523
|
if (!shortcutIcon) {
|
|
1521
1524
|
shortcutIcon = findShortcutIcon(Array.from(doc.querySelectorAll("link[href][rel*=\"icon\"]")));
|
|
1522
1525
|
if (shortcutIcon) {
|
|
1523
|
-
shortcutIcon.rel = "icon";
|
|
1526
|
+
shortcutIcon.rel = "shortcut icon";
|
|
1524
1527
|
}
|
|
1525
1528
|
}
|
|
1526
1529
|
if (shortcutIcon) {
|
|
@@ -23,11 +23,16 @@
|
|
|
23
23
|
|
|
24
24
|
import * as serializer from "./modules/html-serializer.js";
|
|
25
25
|
import * as infobar from "./common/infobar.js";
|
|
26
|
+
import { getInstance } from "./single-file-util.js";
|
|
26
27
|
|
|
28
|
+
const util = getInstance();
|
|
27
29
|
const helper = {
|
|
28
30
|
serialize(doc, compressHTML) {
|
|
29
31
|
return serializer.process(doc, compressHTML);
|
|
30
32
|
},
|
|
33
|
+
getDoctypeString(doc) {
|
|
34
|
+
return util.getDoctypeString(doc);
|
|
35
|
+
},
|
|
31
36
|
appendInfobar(doc, options, useShadowRoot) {
|
|
32
37
|
return infobar.appendInfobar(doc, options, useShadowRoot);
|
|
33
38
|
},
|