| OLD | NEW |
| 1 | 1 |
| 2 | 2 |
| 3 /** | 3 /** |
| 4 * Use `Polymer.IronValidatableBehavior` to implement an element that validate
s user input. | 4 * Use `Polymer.IronValidatableBehavior` to implement an element that validate
s user input. |
| 5 * | 5 * |
| 6 * ### Accessiblity | 6 * ### Accessiblity |
| 7 * | 7 * |
| 8 * Changing the `invalid` property, either manually or by calling `validate()`
will update the | 8 * Changing the `invalid` property, either manually or by calling `validate()`
will update the |
| 9 * `aria-invalid` attribute. | 9 * `aria-invalid` attribute. |
| 10 * | 10 * |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * Name of the validator to use. | 27 * Name of the validator to use. |
| 28 */ | 28 */ |
| 29 validator: { | 29 validator: { |
| 30 type: String | 30 type: String |
| 31 }, | 31 }, |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * True if the last call to `validate` is invalid. | 34 * True if the last call to `validate` is invalid. |
| 35 */ | 35 */ |
| 36 invalid: { | 36 invalid: { |
| 37 notify: true, |
| 37 reflectToAttribute: true, | 38 reflectToAttribute: true, |
| 38 type: Boolean, | 39 type: Boolean, |
| 39 value: false | 40 value: false |
| 40 }, | 41 }, |
| 41 | 42 |
| 42 _validatorMeta: { | 43 _validatorMeta: { |
| 43 type: Object | 44 type: Object |
| 44 } | 45 } |
| 45 | 46 |
| 46 }, | 47 }, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 59 | 60 |
| 60 _invalidChanged: function() { | 61 _invalidChanged: function() { |
| 61 if (this.invalid) { | 62 if (this.invalid) { |
| 62 this.setAttribute('aria-invalid', 'true'); | 63 this.setAttribute('aria-invalid', 'true'); |
| 63 } else { | 64 } else { |
| 64 this.removeAttribute('aria-invalid'); | 65 this.removeAttribute('aria-invalid'); |
| 65 } | 66 } |
| 66 }, | 67 }, |
| 67 | 68 |
| 68 /** | 69 /** |
| 69 * @return {Boolean} True if the validator `validator` exists. | 70 * @return {boolean} True if the validator `validator` exists. |
| 70 */ | 71 */ |
| 71 hasValidator: function() { | 72 hasValidator: function() { |
| 72 return this._validator != null; | 73 return this._validator != null; |
| 73 }, | 74 }, |
| 74 | 75 |
| 75 /** | 76 /** |
| 76 * @param {Object} values Passed to the validator's `validate()` function. | 77 * @param {Object} values Passed to the validator's `validate()` function. |
| 77 * @return {Boolean} True if `values` is valid. | 78 * @return {boolean} True if `values` is valid. |
| 78 */ | 79 */ |
| 79 validate: function(values) { | 80 validate: function(values) { |
| 80 var valid = this._validator && this._validator.validate(values); | 81 var valid = this._validator && this._validator.validate(values); |
| 81 this.invalid = !valid; | 82 this.invalid = !valid; |
| 82 return valid; | 83 return valid; |
| 83 } | 84 } |
| 84 | 85 |
| 85 }; | 86 }; |
| 86 | 87 |
| OLD | NEW |