Skip to content

Commit

Permalink
bugfix for PolymerElements#632
Browse files Browse the repository at this point in the history
  • Loading branch information
jogibear9988 committed Mar 31, 2018
1 parent 59cdb65 commit d481b03
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions paper-input-container.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d481b03

Please sign in to comment.