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

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

Issue 1766433002: Roll Polymer to 1.3.1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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 Polymer({
2 is: 'paper-input-char-counter', 2 is: 'paper-input-char-counter',
3 3
4 behaviors: [ 4 behaviors: [
5 Polymer.PaperInputAddonBehavior 5 Polymer.PaperInputAddonBehavior
6 ], 6 ],
7 7
8 properties: { 8 properties: {
9 _charCounterStr: { 9 _charCounterStr: {
10 type: String, 10 type: String,
(...skipping 12 matching lines...) Expand all
23 * value: The input value. 23 * value: The input value.
24 * invalid: True if the input value is invalid. 24 * invalid: True if the input value is invalid.
25 */ 25 */
26 update: function(state) { 26 update: function(state) {
27 if (!state.inputElement) { 27 if (!state.inputElement) {
28 return; 28 return;
29 } 29 }
30 30
31 state.value = state.value || ''; 31 state.value = state.value || '';
32 32
33 // Account for the textarea's new lines. 33 var counter = state.value.length.toString();
34 var str = state.value.replace(/(\r\n|\n|\r)/g, '--').length.toString();
35 34
36 if (state.inputElement.hasAttribute('maxlength')) { 35 if (state.inputElement.hasAttribute('maxlength')) {
37 str += '/' + state.inputElement.getAttribute('maxlength'); 36 counter += '/' + state.inputElement.getAttribute('maxlength');
38 } 37 }
39 this._charCounterStr = str; 38
39 this._charCounterStr = counter;
40 } 40 }
41 }); 41 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698