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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 /** @const */ var List = cr.ui.List; | 6 /** @const */ var List = cr.ui.List; |
7 /** @const */ var ListItem = cr.ui.ListItem; | 7 /** @const */ var ListItem = cr.ui.ListItem; |
8 | 8 |
9 /** | 9 /** |
10 * Creates a deletable list item, which has a button that will trigger a call | 10 * Creates a deletable list item, which has a button that will trigger a call |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 * Callback for onclick events. | 145 * Callback for onclick events. |
146 * @param {Event} e The click event object. | 146 * @param {Event} e The click event object. |
147 * @override | 147 * @override |
148 */ | 148 */ |
149 handleClick: function(e) { | 149 handleClick: function(e) { |
150 if (this.disabled) | 150 if (this.disabled) |
151 return; | 151 return; |
152 | 152 |
153 var target = e.target; | 153 var target = e.target; |
154 if (target.classList.contains('row-delete-button')) { | 154 if (target.classList.contains('row-delete-button')) { |
155 var listItem = this.getListItemAncestor(target); | 155 var listItem = this.getListItemAncestor( |
| 156 /** @type {HTMLElement} */(target)); |
156 var idx = this.getIndexOfListItem(listItem); | 157 var idx = this.getIndexOfListItem(listItem); |
157 this.deleteItemAtIndex(idx); | 158 this.deleteItemAtIndex(idx); |
158 } | 159 } |
159 }, | 160 }, |
160 | 161 |
161 /** | 162 /** |
162 * Callback for keydown events. | 163 * Callback for keydown events. |
163 * @param {Event} e The keydown event object. | 164 * @param {Event} e The keydown event object. |
164 * @private | 165 * @private |
165 */ | 166 */ |
(...skipping 30 matching lines...) Expand all Loading... |
196 */ | 197 */ |
197 deleteItemAtIndex: function(index) { | 198 deleteItemAtIndex: function(index) { |
198 }, | 199 }, |
199 }; | 200 }; |
200 | 201 |
201 return { | 202 return { |
202 DeletableItemList: DeletableItemList, | 203 DeletableItemList: DeletableItemList, |
203 DeletableItem: DeletableItem, | 204 DeletableItem: DeletableItem, |
204 }; | 205 }; |
205 }); | 206 }); |
OLD | NEW |