| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Use `Polymer.PaperInputBehavior` to implement inputs with `<paper-input-con
tainer>`. This | 2 * Use `Polymer.PaperInputBehavior` to implement inputs with `<paper-input-con
tainer>`. This |
| 3 * behavior is implemented by `<paper-input>`. It exposes a number of properti
es from | 3 * behavior is implemented by `<paper-input>`. It exposes a number of properti
es from |
| 4 * `<paper-input-container>` and `<input is="iron-input">` and they should be
bound in your | 4 * `<paper-input-container>` and `<input is="iron-input">` and they should be
bound in your |
| 5 * template. | 5 * template. |
| 6 * | 6 * |
| 7 * The input element can be accessed by the `inputElement` property if you nee
d to access | 7 * The input element can be accessed by the `inputElement` property if you nee
d to access |
| 8 * properties or methods that are not exposed. | 8 * properties or methods that are not exposed. |
| 9 * @polymerBehavior Polymer.PaperInputBehavior | 9 * @polymerBehavior Polymer.PaperInputBehavior |
| 10 */ | 10 */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 type: Boolean, | 36 type: Boolean, |
| 37 value: false | 37 value: false |
| 38 }, | 38 }, |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Returns true if the value is invalid. Bind this to both the `<paper-inp
ut-container>`'s | 41 * Returns true if the value is invalid. Bind this to both the `<paper-inp
ut-container>`'s |
| 42 * and the input's `invalid` property. | 42 * and the input's `invalid` property. |
| 43 */ | 43 */ |
| 44 invalid: { | 44 invalid: { |
| 45 type: Boolean, | 45 type: Boolean, |
| 46 value: false | 46 value: false, |
| 47 notify: true |
| 47 }, | 48 }, |
| 48 | 49 |
| 49 /** | 50 /** |
| 50 * Set to true to prevent the user from entering invalid input. Bind this
to the | 51 * Set to true to prevent the user from entering invalid input. Bind this
to the |
| 51 * `<input is="iron-input">`'s `preventInvalidInput` property. | 52 * `<input is="iron-input">`'s `preventInvalidInput` property. |
| 52 */ | 53 */ |
| 53 preventInvalidInput: { | 54 preventInvalidInput: { |
| 54 type: Boolean | 55 type: Boolean |
| 55 }, | 56 }, |
| 56 | 57 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 this._ariaDescribedBy = this._appendStringWithSpace(this._ariaDescribedB
y, target.id); | 301 this._ariaDescribedBy = this._appendStringWithSpace(this._ariaDescribedB
y, target.id); |
| 301 } else { | 302 } else { |
| 302 var id = 'paper-input-add-on-' + Math.floor((Math.random() * 100000)); | 303 var id = 'paper-input-add-on-' + Math.floor((Math.random() * 100000)); |
| 303 target.id = id; | 304 target.id = id; |
| 304 this._ariaDescribedBy = this._appendStringWithSpace(this._ariaDescribedB
y, id); | 305 this._ariaDescribedBy = this._appendStringWithSpace(this._ariaDescribedB
y, id); |
| 305 } | 306 } |
| 306 }, | 307 }, |
| 307 | 308 |
| 308 /** | 309 /** |
| 309 * Validates the input element and sets an error style if needed. | 310 * Validates the input element and sets an error style if needed. |
| 311 * |
| 312 * @return {boolean} |
| 310 */ | 313 */ |
| 311 validate: function() { | 314 validate: function() { |
| 312 return this.inputElement.validate(); | 315 return this.inputElement.validate(); |
| 313 }, | 316 }, |
| 317 |
| 318 /** |
| 319 * If `autoValidate` is true, then validates the element. |
| 320 */ |
| 321 _handleAutoValidate: function() { |
| 322 if (this.autoValidate) |
| 323 this.validate(); |
| 324 }, |
| 314 | 325 |
| 315 /** | 326 /** |
| 316 * Restores the cursor to its original position after updating the value. | 327 * Restores the cursor to its original position after updating the value. |
| 317 * @param {string} newValue The value that should be saved. | 328 * @param {string} newValue The value that should be saved. |
| 318 */ | 329 */ |
| 319 updateValueAndPreserveCaret: function(newValue) { | 330 updateValueAndPreserveCaret: function(newValue) { |
| 320 // Not all elements might have selection, and even if they have the | 331 // Not all elements might have selection, and even if they have the |
| 321 // right properties, accessing them might throw an exception (like for | 332 // right properties, accessing them might throw an exception (like for |
| 322 // <input type=number>) | 333 // <input type=number>) |
| 323 try { | 334 try { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 labelledBy = 'paper-input-label-' + new Date().getUTCMilliseconds(); | 380 labelledBy = 'paper-input-label-' + new Date().getUTCMilliseconds(); |
| 370 label.id = labelledBy; | 381 label.id = labelledBy; |
| 371 } | 382 } |
| 372 this._ariaLabelledBy = labelledBy; | 383 this._ariaLabelledBy = labelledBy; |
| 373 } | 384 } |
| 374 | 385 |
| 375 }; | 386 }; |
| 376 | 387 |
| 377 /** @polymerBehavior */ | 388 /** @polymerBehavior */ |
| 378 Polymer.PaperInputBehavior = [Polymer.IronControlState, Polymer.PaperInputBeha
viorImpl]; | 389 Polymer.PaperInputBehavior = [Polymer.IronControlState, Polymer.PaperInputBeha
viorImpl]; |
| OLD | NEW |