| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 Nav dot | 6 * @fileoverview Nav dot |
| 7 * This is the class for the navigation controls that appear along the bottom | 7 * This is the class for the navigation controls that appear along the bottom |
| 8 * of the NTP. | 8 * of the NTP. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 */ | 107 */ |
| 108 switchToPage: function() { | 108 switchToPage: function() { |
| 109 ntp.getCardSlider().selectCardByValue(this.page_, true); | 109 ntp.getCardSlider().selectCardByValue(this.page_, true); |
| 110 }, | 110 }, |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Handler for keydown event on the dot. | 113 * Handler for keydown event on the dot. |
| 114 * @param {Event} e The KeyboardEvent. | 114 * @param {Event} e The KeyboardEvent. |
| 115 */ | 115 */ |
| 116 onKeyDown_: function(e) { | 116 onKeyDown_: function(e) { |
| 117 if (e.keyIdentifier == 'Enter') { | 117 if (e.key == 'Enter') { |
| 118 this.onClick_(e); | 118 this.onClick_(e); |
| 119 e.stopPropagation(); | 119 e.stopPropagation(); |
| 120 } | 120 } |
| 121 }, | 121 }, |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * Clicking causes the associated page to show. | 124 * Clicking causes the associated page to show. |
| 125 * @param {Event} e The click event. | 125 * @param {Event} e The click event. |
| 126 * @private | 126 * @private |
| 127 */ | 127 */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 157 if (this.ownerDocument.activeElement != this.input_) | 157 if (this.ownerDocument.activeElement != this.input_) |
| 158 e.preventDefault(); | 158 e.preventDefault(); |
| 159 }, | 159 }, |
| 160 | 160 |
| 161 /** | 161 /** |
| 162 * Handle keypresses on the input. | 162 * Handle keypresses on the input. |
| 163 * @param {Event} e The click event. | 163 * @param {Event} e The click event. |
| 164 * @private | 164 * @private |
| 165 */ | 165 */ |
| 166 onInputKeyDown_: function(e) { | 166 onInputKeyDown_: function(e) { |
| 167 switch (e.keyIdentifier) { | 167 switch (e.key) { |
| 168 case 'U+001B': // Escape cancels edits. | 168 case 'Escape': // Escape cancels edits. |
| 169 this.input_.value = this.displayTitle; | 169 this.input_.value = this.displayTitle; |
| 170 case 'Enter': // Fall through. | 170 case 'Enter': // Fall through. |
| 171 this.input_.blur(); | 171 this.input_.blur(); |
| 172 break; | 172 break; |
| 173 } | 173 } |
| 174 }, | 174 }, |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * When the input blurs, commit the edited changes. | 177 * When the input blurs, commit the edited changes. |
| 178 * @param {Event} e The blur event. | 178 * @param {Event} e The blur event. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 onTransitionEnd_: function(e) { | 266 onTransitionEnd_: function(e) { |
| 267 if (e.propertyName === 'max-width' && this.classList.contains('small')) | 267 if (e.propertyName === 'max-width' && this.classList.contains('small')) |
| 268 this.parentNode.removeChild(this); | 268 this.parentNode.removeChild(this); |
| 269 }, | 269 }, |
| 270 }; | 270 }; |
| 271 | 271 |
| 272 return { | 272 return { |
| 273 NavDot: NavDot, | 273 NavDot: NavDot, |
| 274 }; | 274 }; |
| 275 }); | 275 }); |
| OLD | NEW |