Service workers: Allow HTTPS pages arrived at via HTTP redirect to use SW
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / paper-input / paper-input-char-counter-extracted.js
blobfc405a55706ff32f0303fafecaa6473aa21ce4d2
1 (function() {
3   Polymer({
5     is: 'paper-input-char-counter',
7     behaviors: [
8       Polymer.PaperInputAddonBehavior
9     ],
11     properties: {
13       _charCounterStr: {
14         type: String,
15         value: '0'
16       }
18     },
20     update: function(state) {
21       if (!state.inputElement) {
22         return;
23       }
25       state.value = state.value || '';
27       // Account for the textarea's new lines.
28       var str = state.value.replace(/(\r\n|\n|\r)/g, '--').length;
30       if (state.inputElement.hasAttribute('maxlength')) {
31         str += '/' + state.inputElement.getAttribute('maxlength');
32       }
33       this._charCounterStr = str;
34     }
36   });
38 })();