single-file-core 1.4.6 → 1.5.0
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/core/index.js
CHANGED
|
@@ -940,7 +940,9 @@ class Processor {
|
|
|
940
940
|
setInputValues() {
|
|
941
941
|
this.doc.querySelectorAll("input:not([type=radio]):not([type=checkbox])").forEach(input => {
|
|
942
942
|
const value = input.getAttribute(util.INPUT_VALUE_ATTRIBUTE_NAME);
|
|
943
|
-
|
|
943
|
+
if (value != null) {
|
|
944
|
+
input.setAttribute("value", value);
|
|
945
|
+
}
|
|
944
946
|
});
|
|
945
947
|
this.doc.querySelectorAll("input[type=radio], input[type=checkbox]").forEach(input => {
|
|
946
948
|
const value = input.getAttribute(util.INPUT_VALUE_ATTRIBUTE_NAME);
|
|
@@ -950,7 +952,9 @@ class Processor {
|
|
|
950
952
|
});
|
|
951
953
|
this.doc.querySelectorAll("textarea").forEach(textarea => {
|
|
952
954
|
const value = textarea.getAttribute(util.INPUT_VALUE_ATTRIBUTE_NAME);
|
|
953
|
-
|
|
955
|
+
if (value != null) {
|
|
956
|
+
textarea.textContent = value;
|
|
957
|
+
}
|
|
954
958
|
});
|
|
955
959
|
this.doc.querySelectorAll("select").forEach(select => {
|
|
956
960
|
select.querySelectorAll("option").forEach(option => {
|
|
@@ -197,11 +197,12 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
197
197
|
if (!(matchCharsetEquals(content.data, content.charset) || matchCharsetEquals(content.data, options.charset))) {
|
|
198
198
|
options = Object.assign({}, options, { charset: getCharset(content.data) });
|
|
199
199
|
await this.resolveLinkStylesheetURLs(stylesheetInfo, element, resourceURL, baseURI, options, workStylesheet, resources, stylesheets);
|
|
200
|
+
} else {
|
|
201
|
+
resourceURL = content.resourceURL;
|
|
202
|
+
content.data = getUpdatedResourceContent(content.resourceURL, options) || content.data;
|
|
203
|
+
stylesheetInfo.stylesheet = cssTree.parse(content.data, { context: "stylesheet", parseCustomProperty: true });
|
|
204
|
+
await this.resolveImportURLs(stylesheetInfo, resourceURL, options, workStylesheet, resources, stylesheets);
|
|
200
205
|
}
|
|
201
|
-
resourceURL = content.resourceURL;
|
|
202
|
-
content.data = getUpdatedResourceContent(content.resourceURL, options) || content.data;
|
|
203
|
-
stylesheetInfo.stylesheet = cssTree.parse(content.data, { context: "stylesheet", parseCustomProperty: true });
|
|
204
|
-
await this.resolveImportURLs(stylesheetInfo, resourceURL, options, workStylesheet, resources, stylesheets);
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
208
|
}
|
package/package.json
CHANGED
|
@@ -40,8 +40,9 @@
|
|
|
40
40
|
const LAZY_LOAD_ATTRIBUTE = "single-file-lazy-load";
|
|
41
41
|
const LOAD_IMAGE_EVENT = "single-file-load-image";
|
|
42
42
|
const IMAGE_LOADED_EVENT = "single-file-image-loaded";
|
|
43
|
+
const FETCH_SUPPORTED_REQUEST_EVENT = "single-file-request-fetch-supported";
|
|
44
|
+
const FETCH_SUPPORTED_RESPONSE_EVENT = "single-file-response-fetch-supported";
|
|
43
45
|
const FETCH_REQUEST_EVENT = "single-file-request-fetch";
|
|
44
|
-
const FETCH_ACK_EVENT = "single-file-ack-fetch";
|
|
45
46
|
const FETCH_RESPONSE_EVENT = "single-file-response-fetch";
|
|
46
47
|
const GET_ADOPTED_STYLESHEETS_REQUEST_EVENT = "single-file-request-get-adopted-stylesheets";
|
|
47
48
|
const UNREGISTER_GET_ADOPTED_STYLESHEETS_REQUEST_EVENT = "single-file-unregister-request-get-adopted-stylesheets";
|
|
@@ -132,8 +133,9 @@
|
|
|
132
133
|
delete globalThis._singleFile_indexedDB;
|
|
133
134
|
}
|
|
134
135
|
});
|
|
136
|
+
document.addEventListener(FETCH_SUPPORTED_REQUEST_EVENT, () =>
|
|
137
|
+
document.dispatchEvent(new CustomEvent(FETCH_SUPPORTED_RESPONSE_EVENT)));
|
|
135
138
|
document.addEventListener(FETCH_REQUEST_EVENT, async event => {
|
|
136
|
-
document.dispatchEvent(new CustomEvent(FETCH_ACK_EVENT));
|
|
137
139
|
const { url, options } = JSON.parse(event.detail);
|
|
138
140
|
let detail;
|
|
139
141
|
try {
|