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

Side by Side Diff: chrome/browser/resources/settings/controls/settings_input.js

Issue 2777343005: MD Settings: minor cleanup for settings-input (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * `settings-input` is a single-line text field for user input associated 7 * `settings-input` is a single-line text field for user input associated
8 * with a pref value. 8 * with a pref value.
9 */ 9 */
10 Polymer({ 10 Polymer({
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 this.$.input.blur(); 105 this.$.input.blur();
106 }, 106 },
107 107
108 /** 108 /**
109 * Keydown handler to specify enter-key and escape-key interactions. 109 * Keydown handler to specify enter-key and escape-key interactions.
110 * @param {!Event} event 110 * @param {!Event} event
111 * @private 111 * @private
112 */ 112 */
113 onKeydown_: function(event) { 113 onKeydown_: function(event) {
114 // If pressed enter when input is invalid, do not trigger on-change. 114 // If pressed enter when input is invalid, do not trigger on-change.
115 if (event.key == 'Enter' && this.invalid) { 115 if (event.key == 'Enter' && this.invalid)
116 event.preventDefault(); 116 event.preventDefault();
117 return; 117 else if (event.key == 'Escape')
118 } 118 this.resetValue_();
119
120 if (event.key != 'Escape')
121 return;
122
123 this.resetValue_();
124 }, 119 },
125 120
126 /** 121 /**
127 * @param {boolean} disabled 122 * @param {boolean} disabled
128 * @return {boolean} Whether the element should be disabled. 123 * @return {boolean} Whether the element should be disabled.
129 * @private 124 * @private
130 */ 125 */
131 isDisabled_: function(disabled) { 126 isDisabled_: function(disabled) {
132 return disabled || this.isPrefEnforced(); 127 return disabled || this.isPrefEnforced();
133 }, 128 },
134 }); 129 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698