From 10d913154cac7b16352989272df9075ec3b4fa9c Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Tue, 31 Jan 2023 14:38:56 -0500 Subject: [PATCH] interface.js: explicitly request to mount forms after creating elements --- package.json | 2 +- src/aes.js | 2 ++ src/interface.js | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b704cd4..751553c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "encryptme", - "version": "0.5.0", + "version": "0.5.1", "description": "Simple online cryptography app.", "private": true, "scripts": { diff --git a/src/aes.js b/src/aes.js index 0e221a7..f666a61 100644 --- a/src/aes.js +++ b/src/aes.js @@ -155,6 +155,8 @@ let decManualKey = decForm.createCheckBox({ let decButton = decForm.createButton({label: "Decrypt"}); let decOut = decForm.createOutput({label: "Output"}); +tabs.mountForms(); + function getKeyMaterial(password) { let enc = new TextEncoder(); return window.crypto.subtle.importKey( diff --git a/src/interface.js b/src/interface.js index 77eda9a..652cec1 100644 --- a/src/interface.js +++ b/src/interface.js @@ -97,7 +97,7 @@ function dataTypeSupports(params, validTypes) { } class Form extends InterfaceElement { - constructor({tag, par=document.body, label}) { + constructor({tag, par=document.body, label, mounted=false}) { super({}); if (tag === undefined) { @@ -121,7 +121,9 @@ class Form extends InterfaceElement { this.advanced = advancedToggle.value; }.bind(this)); - par.appendChild(this.fragment); + if (mounted) { + this.mount(par); + } } #hidden = false; @@ -488,7 +490,8 @@ class TabList extends InterfaceElement { this.handle = tag; } this.fragment.appendChild(this.handle); - par.appendChild(this.fragment); + + this.mount(par); } tabs = []; @@ -532,6 +535,12 @@ class TabList extends InterfaceElement { return form; } + + mountForms() { + for (const tab of this.tabs) { + tab.form.mount(this.par); + } + } } export { TabList, FormElement, Form };