|
|
@@ -95,7 +95,6 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
|
|
|
imports: []
|
|
|
};
|
|
|
}
|
|
|
- saveInputValues(doc);
|
|
|
return {
|
|
|
canvases: elementsInfo.canvases,
|
|
|
fonts: getFontsData(doc),
|
|
|
@@ -216,6 +215,24 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
|
|
|
element.setAttribute(HTML_IMPORT_ATTRIBUTE_NAME, data.imports.length - 1);
|
|
|
}
|
|
|
}
|
|
|
+ if (element.tagName == "INPUT") {
|
|
|
+ if (element.type != "password") {
|
|
|
+ element.setAttribute(INPUT_VALUE_ATTRIBUTE_NAME, element.value);
|
|
|
+ }
|
|
|
+ if (element.type == "radio" || element.type == "checkbox") {
|
|
|
+ element.setAttribute(INPUT_VALUE_ATTRIBUTE_NAME, element.checked);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (element.tagName == "TEXTAREA") {
|
|
|
+ element.setAttribute(INPUT_VALUE_ATTRIBUTE_NAME, element.value);
|
|
|
+ }
|
|
|
+ if (element.tagName == "SELECT") {
|
|
|
+ element.querySelectorAll("option").forEach(option => {
|
|
|
+ if (option.selected) {
|
|
|
+ option.setAttribute(INPUT_VALUE_ATTRIBUTE_NAME, "");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function getUsedFont(computedStyle, options, usedFonts) {
|
|
|
@@ -350,19 +367,6 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function saveInputValues(doc) {
|
|
|
- doc.querySelectorAll("input:not([type=password])").forEach(input => input.setAttribute(INPUT_VALUE_ATTRIBUTE_NAME, input.value));
|
|
|
- doc.querySelectorAll("input[type=radio], input[type=checkbox]").forEach(input => input.setAttribute(INPUT_VALUE_ATTRIBUTE_NAME, input.checked));
|
|
|
- doc.querySelectorAll("textarea").forEach(textarea => textarea.setAttribute(INPUT_VALUE_ATTRIBUTE_NAME, textarea.value));
|
|
|
- doc.querySelectorAll("select").forEach(select => {
|
|
|
- select.querySelectorAll("option").forEach(option => {
|
|
|
- if (option.selected) {
|
|
|
- option.setAttribute(INPUT_VALUE_ATTRIBUTE_NAME, "");
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
function serialize(doc) {
|
|
|
const docType = doc.doctype;
|
|
|
let docTypeString = "";
|