Update Polymer and pull in iron-list
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / paper-input / paper-input-char-counter-extracted.js
blob7c889f0bde469e354409fc0562f3a9dcb15e04c5
2   Polymer({
3     is: 'paper-input-char-counter',
5     behaviors: [
6       Polymer.PaperInputAddonBehavior
7     ],
9     properties: {
10       _charCounterStr: {
11         type: String,
12         value: '0'
13       }
14     },
16     update: function(state) {
17       if (!state.inputElement) {
18         return;
19       }
21       state.value = state.value || '';
23       // Account for the textarea's new lines.
24       var str = state.value.replace(/(\r\n|\n|\r)/g, '--').length;
26       if (state.inputElement.hasAttribute('maxlength')) {
27         str += '/' + state.inputElement.getAttribute('maxlength');
28       }
29       this._charCounterStr = str;
30     }
31   });