From 283a7f2f695572e353030ea2539b570727709cd6 Mon Sep 17 00:00:00 2001 From: Arturo GARCIA-VARGAS Date: Thu, 8 Aug 2019 19:23:48 +0100 Subject: [PATCH] Fix button.type = 'submit' and support button.type = 'reset' - Fix #1190 --- src/dom/forms.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dom/forms.js b/src/dom/forms.js index 3108a85e8..b2c75dfc9 100644 --- a/src/dom/forms.js +++ b/src/dom/forms.js @@ -244,9 +244,19 @@ DOM.HTMLButtonElement.prototype._click = function(event) { if (button.getAttribute('disabled')) return false; + const buttonType = button.getAttribute('type'); + if (buttonType === 'button') + return; + const form = button.form; - if (form) + if (form) { + if (buttonType === 'reset') { + input.form.reset(); + return; + } + return form._dispatchSubmitEvent(button); + } }; DOM.HTMLInputElement.prototype._click = function(event) {