From d31635d76447393e72c4e4c2f4caa5a6ab9b6156 Mon Sep 17 00:00:00 2001 From: jogibear9988 Date: Sat, 31 Mar 2018 14:41:14 +0200 Subject: [PATCH] bugfix for #632 --- paper-input-container.html | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/paper-input-container.html b/paper-input-container.html index f5243d7d..28ede7ea 100644 --- a/paper-input-container.html +++ b/paper-input-container.html @@ -521,10 +521,21 @@ }, attached: function() { - if (this.attrForValue) { - this._inputElement.addEventListener(this._valueChangedEvent, this._boundValueChanged); - } else { - this.addEventListener('input', this._onInput); + if (!this._listenersAttached) { + if (this.attrForValue) { + this._inputElement.addEventListener(this._valueChangedEvent, this._boundValueChanged); + } else { + this.addEventListener('input', this._onInput); + } + + if (this._inputElement) { + this._htmlInput = this._inputElement; + if (this._inputElement.nodeName === 'IRON-INPUT') { + this._htmlInput = this._inputElement.inputElement; + } + } + this._htmlInput.addEventListener("keyup", (e) => this._handleValue(this._inputElement)); + this._listenersAttached = true; } // Only validate when attached if the input already has a value. @@ -588,7 +599,7 @@ var value = this._inputElementValue; // type="number" hack needed because this.value is empty until it's valid - if (value || value === 0 || (inputElement.type === 'number' && !inputElement.checkValidity())) { + if (value || value === 0 || ( this._htmlInput.type === 'number' && !this._htmlInput.checkValidity())) { this._inputHasContent = true; } else { this._inputHasContent = false;