OLD | NEW |
1 <!-- | 1 <!-- |
2 @license | 2 @license |
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --> | 9 --> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 <template> | 34 <template> |
35 <style> | 35 <style> |
36 :host { | 36 :host { |
37 display: inline-block; | 37 display: inline-block; |
38 float: right; | 38 float: right; |
39 | 39 |
40 @apply(--paper-font-caption); | 40 @apply(--paper-font-caption); |
41 @apply(--paper-input-char-counter); | 41 @apply(--paper-input-char-counter); |
42 } | 42 } |
43 | 43 |
| 44 :host([hidden]) { |
| 45 display: none !important; |
| 46 } |
| 47 |
44 :host-context([dir="rtl"]) { | 48 :host-context([dir="rtl"]) { |
45 float: left; | 49 float: left; |
46 } | 50 } |
47 </style> | 51 </style> |
48 | 52 |
49 <span>[[_charCounterStr]]</span> | 53 <span>[[_charCounterStr]]</span> |
50 </template> | 54 </template> |
51 </dom-module> | 55 </dom-module> |
52 | 56 |
53 <script> | 57 <script> |
(...skipping 22 matching lines...) Expand all Loading... |
76 * value: The input value. | 80 * value: The input value. |
77 * invalid: True if the input value is invalid. | 81 * invalid: True if the input value is invalid. |
78 */ | 82 */ |
79 update: function(state) { | 83 update: function(state) { |
80 if (!state.inputElement) { | 84 if (!state.inputElement) { |
81 return; | 85 return; |
82 } | 86 } |
83 | 87 |
84 state.value = state.value || ''; | 88 state.value = state.value || ''; |
85 | 89 |
86 var counter = state.value.length.toString(); | 90 var counter = state.value.toString().length.toString(); |
87 | 91 |
88 if (state.inputElement.hasAttribute('maxlength')) { | 92 if (state.inputElement.hasAttribute('maxlength')) { |
89 counter += '/' + state.inputElement.getAttribute('maxlength'); | 93 counter += '/' + state.inputElement.getAttribute('maxlength'); |
90 } | 94 } |
91 | 95 |
92 this._charCounterStr = counter; | 96 this._charCounterStr = counter; |
93 } | 97 } |
94 }); | 98 }); |
95 </script> | 99 </script> |
OLD | NEW |