ApplicationImpl cleanup, part 1:
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / paper-input / paper-input-char-counter-extracted.js
blob673f5e79bf900bea273f12f1a0569048f6213f9b
3 (function() {
5 Polymer({
7 is: 'paper-input-char-counter',
9 behaviors: [
10 Polymer.PaperInputAddonBehavior
13 properties: {
15 _charCounterStr: {
16 type: String,
17 value: '0'
22 update: function(state) {
23 if (!state.inputElement) {
24 return;
27 state.value = state.value || '';
29 // Account for the textarea's new lines.
30 var str = state.value.replace(/(\r\n|\n|\r)/g, '--').length;
32 if (state.inputElement.hasAttribute('maxlength')) {
33 str += '/' + state.inputElement.getAttribute('maxlength');
35 this._charCounterStr = str;
38 });
40 })();