Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js

Issue 1336623003: [MD settings] updating polymer to 1.1.13 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed Polymer.IronCheckedElementBehavior name Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
-
- });
-
-})();
+ });

Powered by Google App Engine
This is Rietveld 408576698