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

Unified Diff: third_party/polymer/v1_0/components-chromium/iron-autogrow-textarea/iron-autogrow-textarea-extracted.js

Issue 1221923003: Update bower.json for Polymer elements and add PRESUBMIT.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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/iron-autogrow-textarea/iron-autogrow-textarea-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/iron-autogrow-textarea/iron-autogrow-textarea-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-autogrow-textarea/iron-autogrow-textarea-extracted.js
index de9ac3f54a4a1d9c1993ff1713b660bacec56694..d69ffdb59b030c86b67e948366bb4037ea35206a 100644
--- a/third_party/polymer/v1_0/components-chromium/iron-autogrow-textarea/iron-autogrow-textarea-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/iron-autogrow-textarea/iron-autogrow-textarea-extracted.js
@@ -5,7 +5,9 @@
is: 'iron-autogrow-textarea',
behaviors: [
- Polymer.IronValidatableBehavior
+ Polymer.IronFormElementBehavior,
+ Polymer.IronValidatableBehavior,
+ Polymer.IronControlState
],
properties: {
@@ -76,6 +78,15 @@
},
/**
+ * The value for this input, same as `bindValue`
+ */
+ value: {
+ notify: true,
+ type: String,
+ computed: '_computeValue(bindValue)'
+ },
+
+ /**
* Bound to the textarea's `placeholder` attribute.
*/
placeholder: {
@@ -111,11 +122,36 @@
/**
* Returns the underlying textarea.
+ * @type HTMLTextAreaElement
*/
get textarea() {
return this.$.textarea;
},
+ /**
+ * Returns true if `value` is valid. The validator provided in `validator`
+ * will be used first, if it exists; otherwise, the `textarea`'s validity
+ * is used.
+ * @return {boolean} True if the value is valid.
+ */
+ validate: function() {
+ // Empty, non-required input is valid.
+ if (!this.required && this.value == '') {
+ this.invalid = false;
+ return true;
+ }
+
+ var valid;
+ if (this.hasValidator()) {
+ valid = Polymer.IronValidatableBehavior.validate.call(this, this.value);
+ } else {
+ valid = this.$.textarea.validity.valid;
+ this.invalid = !valid;
+ }
+ this.fire('iron-input-validate');
+ return valid;
+ },
+
_update: function() {
this.$.mirror.innerHTML = this._valueForMirror();
@@ -170,5 +206,9 @@
_updateCached: function() {
this.$.mirror.innerHTML = this._constrain(this.tokens);
+ },
+
+ _computeValue: function() {
+ return this.bindValue;
}
})

Powered by Google App Engine
This is Rietveld 408576698