function rebuildInput (form) {
      form.empty();
      const inp = document.createElement('input');
      inp.type = 'file';
      inp.name = 'svg_file';
      form.appendChild(inp);

      /**
       * Submit the form, empty its contents for reuse and show
       *   uploading message.
       * @returns {Promise<void>}
       */
      async function submit () {
        // This submits the form, which returns the file data using `svgEditor.processFile()`
        form.submit();

        rebuildInput(form);
        // await $.process_cancel(strings.uploading);
        cancelled = true;
        if($id("dialog_box") != null) $id("dialog_box").style.display = 'none';
      }

      if (form[0] === openSvgForm[0]) {
        inp.change(async function () {
          // This takes care of the "are you sure" dialog box
          const ok = await svgEditor.openPrep();
          if (!ok) {
            rebuildInput(form);
            return;
          }
          await submit();
        });
      } else {
        inp.change(async function () {
          // This submits the form, which returns the file data using svgEditor.processFile()
          await submit();
        });
      }
    }
@param {external:jQuery} form
@returns {void}