mirror of https://github.com/perkeep/perkeep.git
camlistored/ui: connect temp form to DOM before submitting
The download action of the web UI uses an ephemeral form, that we do not connect to the DOM, behind the scenes. However, according to https://html.spec.whatwg.org/multipage/forms.html#form-submission-algorithm, step 2., a form must be connected to the DOM in order for it to be submitted. This change connects the form right before submitting, and removes it from the DOM right after submission. Fixes #921 Change-Id: I4d993c633c60a369ce4260f84731a64e8b955c76
This commit is contained in:
parent
8a545a1ed2
commit
dace68256b
|
@ -144,6 +144,12 @@ func (d *DownloadItemsBtnDef) downloadSelection() error {
|
||||||
form.Action = downloadPrefix
|
form.Action = downloadPrefix
|
||||||
form.Method = "POST"
|
form.Method = "POST"
|
||||||
form.AppendChild(input)
|
form.AppendChild(input)
|
||||||
|
// As per
|
||||||
|
// https://html.spec.whatwg.org/multipage/forms.html#form-submission-algorithm
|
||||||
|
// step 2., a form must be connected to the DOM for submission.
|
||||||
|
body := dom.GetWindow().Document().QuerySelector("body")
|
||||||
|
body.AppendChild(form)
|
||||||
|
defer body.RemoveChild(form)
|
||||||
form.Submit()
|
form.Submit()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue