| Index: third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js
|
| index 585e4c8d377bcee07957480b523b83fdd52053a4..d214ad6774bee104bc7e3969fc0fdbcea60383ec 100644
|
| --- a/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js
|
| +++ b/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js
|
| @@ -1,11 +1,7 @@
|
| -(function() {
|
| -
|
| - Polymer({
|
| -
|
| +Polymer({
|
| is: 'paper-input-container',
|
|
|
| properties: {
|
| -
|
| /**
|
| * Set to true to disable the floating label. The label disappears when the input value is
|
| * not null.
|
| @@ -55,7 +51,8 @@
|
| focused: {
|
| readOnly: true,
|
| type: Boolean,
|
| - value: false
|
| + value: false,
|
| + notify: true
|
| },
|
|
|
| _addons: {
|
| @@ -102,7 +99,6 @@
|
| return this._onValueChanged.bind(this);
|
| }
|
| }
|
| -
|
| },
|
|
|
| listeners: {
|
| @@ -122,6 +118,10 @@
|
| return Polymer.dom(this).querySelector(this._inputSelector);
|
| },
|
|
|
| + get _inputElementValue() {
|
| + return this._inputElement[this._propertyForValue] || this._inputElement.value;
|
| + },
|
| +
|
| ready: function() {
|
| if (!this._addons) {
|
| this._addons = [];
|
| @@ -136,7 +136,12 @@
|
| },
|
|
|
| attached: function() {
|
| - this._handleValue(this._inputElement);
|
| + // Only validate when attached if the input already has a value.
|
| + if (this._inputElementValue != '') {
|
| + this._handleValueAndAutoValidate(this._inputElement);
|
| + } else {
|
| + this._handleValue(this._inputElement);
|
| + }
|
| },
|
|
|
| _onAddonAttached: function(event) {
|
| @@ -158,28 +163,19 @@
|
|
|
| _onBlur: function() {
|
| this._setFocused(false);
|
| + this._handleValueAndAutoValidate(this._inputElement);
|
| },
|
|
|
| _onInput: function(event) {
|
| - this._handleValue(event.target);
|
| + this._handleValueAndAutoValidate(event.target);
|
| },
|
|
|
| _onValueChanged: function(event) {
|
| - this._handleValue(event.target);
|
| + this._handleValueAndAutoValidate(event.target);
|
| },
|
|
|
| _handleValue: function(inputElement) {
|
| - var value = inputElement[this._propertyForValue] || inputElement.value;
|
| -
|
| - if (this.autoValidate) {
|
| - var valid;
|
| - if (inputElement.validate) {
|
| - valid = inputElement.validate(value);
|
| - } else {
|
| - valid = inputElement.checkValidity();
|
| - }
|
| - this.invalid = !valid;
|
| - }
|
| + 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())) {
|
| @@ -195,6 +191,21 @@
|
| });
|
| },
|
|
|
| + _handleValueAndAutoValidate: function(inputElement) {
|
| + if (this.autoValidate) {
|
| + var valid;
|
| + if (inputElement.validate) {
|
| + valid = inputElement.validate(this._inputElementValue);
|
| + } else {
|
| + valid = inputElement.checkValidity();
|
| + }
|
| + this.invalid = !valid;
|
| + }
|
| +
|
| + // Call this last to notify the add-ons.
|
| + this._handleValue(inputElement);
|
| + },
|
| +
|
| _onIronInputValidate: function(event) {
|
| this.invalid = this._inputElement.invalid;
|
| },
|
| @@ -266,7 +277,4 @@
|
| }
|
| return cls;
|
| }
|
| -
|
| - });
|
| -
|
| -})();
|
| + });
|
|
|