From 761d62ae16d75e08a63c4a2616946e065036baf3 Mon Sep 17 00:00:00 2001 From: Monica Dinculescu Date: Wed, 17 Feb 2016 17:14:16 -0800 Subject: [PATCH] fix resetting of paper-input and paper-textarea --- iron-form.html | 12 ++++++++++ test/basic.html | 61 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 69 insertions(+), 4 deletions(-) diff --git a/iron-form.html b/iron-form.html index 26495cf..be6e8f5 100644 --- a/iron-form.html +++ b/iron-form.html @@ -452,6 +452,18 @@ el.checked = this._customElementsInitialValues[i]; } else { el.value = this._customElementsInitialValues[i]; + + // In the shady DOM, the native form is all-seeing, and will + // reset the nested inputs inside and . + // In particular, it resets them to what it thinks the default value + // is (i.e. "", before the bindings have ran), and since this is + // a programmatic update, it also doesn't fire any events. + // Which means we need to manually update the native element's value. + if (el.inputElement) { + el.inputElement.value = el.value; + } else if (el.textarea) { + el.textarea.value = el.value; + } } el.invalid = false; } diff --git a/test/basic.html b/test/basic.html index 8be9973..5201f2e 100644 --- a/test/basic.html +++ b/test/basic.html @@ -16,6 +16,8 @@ + + @@ -120,6 +122,8 @@