mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
Supports Safari in form submission event
This commit is contained in:
parent
bee1b2a2eb
commit
7cfb0a4271
1 changed files with 12 additions and 2 deletions
|
@ -64,9 +64,19 @@ let StatusCache = new class {
|
||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
submitStatus(event) {
|
submitStatus(event) {
|
||||||
event.preventDefault();
|
|
||||||
const form = event.currentTarget;
|
const form = event.currentTarget;
|
||||||
const trigger = event.submitter;
|
let trigger = event.submitter;
|
||||||
|
|
||||||
|
// Safari doesn't understand "submitter"
|
||||||
|
if (!trigger) {
|
||||||
|
trigger = event.currentTarget.querySelector("button[type=submit]");
|
||||||
|
}
|
||||||
|
// this allows the form to submit in the old fashioned way if there's a problem
|
||||||
|
if (!trigger || !form) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
BookWyrm.addRemoveClass(form, 'is-processing', true);
|
BookWyrm.addRemoveClass(form, 'is-processing', true);
|
||||||
trigger.setAttribute('disabled', null);
|
trigger.setAttribute('disabled', null);
|
||||||
|
|
Loading…
Reference in a new issue