| OLD | NEW |
| 1 | 1 Polymer({ |
| 2 | 2 |
| 3 Polymer({ | |
| 4 | |
| 5 is: 'iron-autogrow-textarea', | 3 is: 'iron-autogrow-textarea', |
| 6 | 4 |
| 7 behaviors: [ | 5 behaviors: [ |
| 8 Polymer.IronFormElementBehavior, | 6 Polymer.IronFormElementBehavior, |
| 9 Polymer.IronValidatableBehavior, | 7 Polymer.IronValidatableBehavior, |
| 10 Polymer.IronControlState | 8 Polymer.IronControlState |
| 11 ], | 9 ], |
| 12 | 10 |
| 13 properties: { | 11 properties: { |
| 14 | 12 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 this.fire('iron-input-validate'); | 179 this.fire('iron-input-validate'); |
| 182 return valid; | 180 return valid; |
| 183 }, | 181 }, |
| 184 | 182 |
| 185 _bindValueChanged: function() { | 183 _bindValueChanged: function() { |
| 186 var textarea = this.textarea; | 184 var textarea = this.textarea; |
| 187 if (!textarea) { | 185 if (!textarea) { |
| 188 return; | 186 return; |
| 189 } | 187 } |
| 190 | 188 |
| 191 textarea.value = this.bindValue; | 189 // If the bindValue changed manually, then we need to also update |
| 190 // the underlying textarea's value. Otherwise this change was probably |
| 191 // generated from the _onInput handler, and the two values are already |
| 192 // the same. |
| 193 if (textarea.value !== this.bindValue) { |
| 194 textarea.value = !(this.bindValue || this.bindValue === 0) ? '' : this.b
indValue; |
| 195 } |
| 196 |
| 192 this.$.mirror.innerHTML = this._valueForMirror(); | 197 this.$.mirror.innerHTML = this._valueForMirror(); |
| 193 // manually notify because we don't want to notify until after setting val
ue | 198 // manually notify because we don't want to notify until after setting val
ue |
| 194 this.fire('bind-value-changed', {value: this.bindValue}); | 199 this.fire('bind-value-changed', {value: this.bindValue}); |
| 195 }, | 200 }, |
| 196 | 201 |
| 197 _onInput: function(event) { | 202 _onInput: function(event) { |
| 198 this.bindValue = event.path ? event.path[0].value : event.target.value; | 203 this.bindValue = event.path ? event.path[0].value : event.target.value; |
| 199 }, | 204 }, |
| 200 | 205 |
| 201 _constrain: function(tokens) { | 206 _constrain: function(tokens) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 222 return this._constrain(this.tokens); | 227 return this._constrain(this.tokens); |
| 223 }, | 228 }, |
| 224 | 229 |
| 225 _updateCached: function() { | 230 _updateCached: function() { |
| 226 this.$.mirror.innerHTML = this._constrain(this.tokens); | 231 this.$.mirror.innerHTML = this._constrain(this.tokens); |
| 227 }, | 232 }, |
| 228 | 233 |
| 229 _computeValue: function() { | 234 _computeValue: function() { |
| 230 return this.bindValue; | 235 return this.bindValue; |
| 231 } | 236 } |
| 232 }); | 237 }); |
| OLD | NEW |