diff options
author | Tasos Maschalidis <tas.o.s@hotmail.com> | 2018-11-24 21:54:05 +0200 |
---|---|---|
committer | George Claghorn <george.claghorn@gmail.com> | 2018-11-24 14:54:05 -0500 |
commit | d6fcc419fe4f99d3f9414d39d081bd6355842018 (patch) | |
tree | d2de1b95ad5ef5548bfc37077eb1173dc20167de | |
parent | f3a79e6aa5da48ac3e4d2fbedf44cb7b58f2a379 (diff) | |
download | rails-d6fcc419fe4f99d3f9414d39d081bd6355842018.tar.gz rails-d6fcc419fe4f99d3f9414d39d081bd6355842018.tar.bz2 rails-d6fcc419fe4f99d3f9414d39d081bd6355842018.zip |
ASt direct uploads: account for <button type="submit"> elements
-rw-r--r-- | activestorage/app/assets/javascripts/activestorage.js | 4 | ||||
-rw-r--r-- | activestorage/app/javascript/activestorage/ujs.js | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activestorage/app/assets/javascripts/activestorage.js b/activestorage/app/assets/javascripts/activestorage.js index 375eb6b533..b71e251a11 100644 --- a/activestorage/app/assets/javascripts/activestorage.js +++ b/activestorage/app/assets/javascripts/activestorage.js @@ -867,7 +867,7 @@ } function didClick(event) { var target = event.target; - if (target.tagName == "INPUT" && target.type == "submit" && target.form) { + if ((target.tagName == "INPUT" || target.tagName == "BUTTON") && target.type == "submit" && target.form) { submitButtonsByForm.set(target.form, target); } } @@ -902,7 +902,7 @@ } } function submitForm(form) { - var button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit]"); + var button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit], button[type=submit]"); if (button) { var _button = button, disabled = _button.disabled; button.disabled = false; diff --git a/activestorage/app/javascript/activestorage/ujs.js b/activestorage/app/javascript/activestorage/ujs.js index f5353389ef..98fcba60fa 100644 --- a/activestorage/app/javascript/activestorage/ujs.js +++ b/activestorage/app/javascript/activestorage/ujs.js @@ -16,7 +16,7 @@ export function start() { function didClick(event) { const { target } = event - if (target.tagName == "INPUT" && target.type == "submit" && target.form) { + if ((target.tagName == "INPUT" || target.tagName == "BUTTON") && target.type == "submit" && target.form) { submitButtonsByForm.set(target.form, target) } } @@ -58,7 +58,7 @@ function handleFormSubmissionEvent(event) { } function submitForm(form) { - let button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit]") + let button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit], button[type=submit]") if (button) { const { disabled } = button |