| OLD | NEW |
| 1 /* | 1 /* |
| 2 `<iron-input>` adds two-way binding and custom validators using `Polymer.IronVal
idatorBehavior` | 2 `<iron-input>` adds two-way binding and custom validators using `Polymer.IronVal
idatorBehavior` |
| 3 to `<input>`. | 3 to `<input>`. |
| 4 | 4 |
| 5 ### Two-way binding | 5 ### Two-way binding |
| 6 | 6 |
| 7 By default you can only get notified of changes to an `input`'s `value` due to u
ser input: | 7 By default you can only get notified of changes to an `input`'s `value` due to u
ser input: |
| 8 | 8 |
| 9 <input value="{{myValue::input}}"> | 9 <input value="{{myValue::input}}"> |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 break; | 98 break; |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 return pattern; | 101 return pattern; |
| 102 }, | 102 }, |
| 103 | 103 |
| 104 ready: function() { | 104 ready: function() { |
| 105 this.bindValue = this.value; | 105 this.bindValue = this.value; |
| 106 }, | 106 }, |
| 107 | 107 |
| 108 /** |
| 109 * @suppress {checkTypes} |
| 110 */ |
| 108 _bindValueChanged: function() { | 111 _bindValueChanged: function() { |
| 109 if (this.value !== this.bindValue) { | 112 if (this.value !== this.bindValue) { |
| 110 this.value = !(this.bindValue || this.bindValue === 0) ? '' : this.bindV
alue; | 113 this.value = !(this.bindValue || this.bindValue === 0) ? '' : this.bindV
alue; |
| 111 } | 114 } |
| 112 // manually notify because we don't want to notify until after setting val
ue | 115 // manually notify because we don't want to notify until after setting val
ue |
| 113 this.fire('bind-value-changed', {value: this.bindValue}); | 116 this.fire('bind-value-changed', {value: this.bindValue}); |
| 114 }, | 117 }, |
| 115 | 118 |
| 116 _onInput: function() { | 119 _onInput: function() { |
| 117 // Need to validate each of the characters pasted if they haven't | 120 // Need to validate each of the characters pasted if they haven't |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 this.fire('iron-input-validate'); | 220 this.fire('iron-input-validate'); |
| 218 return valid; | 221 return valid; |
| 219 } | 222 } |
| 220 | 223 |
| 221 }); | 224 }); |
| 222 | 225 |
| 223 /* | 226 /* |
| 224 The `iron-input-validate` event is fired whenever `validate()` is called. | 227 The `iron-input-validate` event is fired whenever `validate()` is called. |
| 225 @event iron-input-validate | 228 @event iron-input-validate |
| 226 */ | 229 */ |
| OLD | NEW |