Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: third_party/polymer/v1_0/components-chromium/paper-input/paper-input-char-counter-extracted.js

Issue 1351623008: MD Settings: Languages model for language pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SingletonPrefs
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 Polymer({ 1
2 Polymer({
2 is: 'paper-input-char-counter', 3 is: 'paper-input-char-counter',
3 4
4 behaviors: [ 5 behaviors: [
5 Polymer.PaperInputAddonBehavior 6 Polymer.PaperInputAddonBehavior
6 ], 7 ],
7 8
8 properties: { 9 properties: {
9 _charCounterStr: { 10 _charCounterStr: {
10 type: String, 11 type: String,
11 value: '0' 12 value: '0'
12 } 13 }
13 }, 14 },
14 15
15 update: function(state) { 16 update: function(state) {
16 if (!state.inputElement) { 17 if (!state.inputElement) {
17 return; 18 return;
18 } 19 }
19 20
20 state.value = state.value || ''; 21 state.value = state.value || '';
21 22
22 // Account for the textarea's new lines. 23 // Account for the textarea's new lines.
23 var str = state.value.replace(/(\r\n|\n|\r)/g, '--').length; 24 var str = state.value.replace(/(\r\n|\n|\r)/g, '--').length;
24 25
25 if (state.inputElement.hasAttribute('maxlength')) { 26 if (state.inputElement.hasAttribute('maxlength')) {
26 str += '/' + state.inputElement.getAttribute('maxlength'); 27 str += '/' + state.inputElement.getAttribute('maxlength');
27 } 28 }
28 this._charCounterStr = str; 29 this._charCounterStr = str;
29 } 30 }
30 }); 31 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698