OLD | NEW |
(Empty) | |
| 1 |
| 2 |
| 3 (function() { |
| 4 |
| 5 Polymer({ |
| 6 |
| 7 is: 'paper-input-char-counter', |
| 8 |
| 9 enableCustomStyleProperties: true, |
| 10 |
| 11 hostAttributes: { |
| 12 'add-on': '' |
| 13 }, |
| 14 |
| 15 properties: { |
| 16 |
| 17 /** |
| 18 * The associated input element. |
| 19 */ |
| 20 inputElement: { |
| 21 type: Object |
| 22 }, |
| 23 |
| 24 /** |
| 25 * The current value of the input element. |
| 26 */ |
| 27 value: { |
| 28 type: String |
| 29 }, |
| 30 |
| 31 /** |
| 32 * The character counter string. |
| 33 */ |
| 34 charCounter: { |
| 35 computed: '_computeCharCounter(inputElement,value)', |
| 36 type: String |
| 37 } |
| 38 |
| 39 }, |
| 40 |
| 41 attached: function() { |
| 42 this.fire('addon-attached'); |
| 43 }, |
| 44 |
| 45 _computeCharCounter: function(inputElement,value) { |
| 46 var str = value.length; |
| 47 if (inputElement.hasAttribute('maxlength')) { |
| 48 str += '/' + inputElement.maxLength; |
| 49 } |
| 50 return str; |
| 51 } |
| 52 |
| 53 }); |
| 54 |
| 55 })(); |
| 56 |
OLD | NEW |