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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 /** | 115 /** |
116 * Callback for onclick events. | 116 * Callback for onclick events. |
117 * @param {Event} e The click event object. | 117 * @param {Event} e The click event object. |
118 * @private | 118 * @private |
119 */ | 119 */ |
120 handleClick_: function(e) { | 120 handleClick_: function(e) { |
121 if (this.disabled) | 121 if (this.disabled) |
122 return; | 122 return; |
123 | 123 |
124 var target = e.target; | 124 var target = e.target; |
125 if (target.classList.contains('close-button')) { | 125 if (target.classList.contains('row-delete-button')) { |
126 var listItem = this.getListItemAncestor(target); | 126 var listItem = this.getListItemAncestor(target); |
127 var selected = this.selectionModel.selectedIndexes; | 127 var selected = this.selectionModel.selectedIndexes; |
128 | 128 |
129 // Check if the list item that contains the close button being clicked | 129 // Check if the list item that contains the close button being clicked |
130 // is not in the list of selected items. Only delete this item in that | 130 // is not in the list of selected items. Only delete this item in that |
131 // case. | 131 // case. |
132 var idx = this.getIndexOfListItem(listItem); | 132 var idx = this.getIndexOfListItem(listItem); |
133 if (selected.indexOf(idx) == -1) { | 133 if (selected.indexOf(idx) == -1) { |
134 this.deleteItemAtIndex(idx); | 134 this.deleteItemAtIndex(idx); |
135 } else { | 135 } else { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 */ | 176 */ |
177 deleteItemAtIndex: function(index) { | 177 deleteItemAtIndex: function(index) { |
178 }, | 178 }, |
179 }; | 179 }; |
180 | 180 |
181 return { | 181 return { |
182 DeletableItemList: DeletableItemList, | 182 DeletableItemList: DeletableItemList, |
183 DeletableItem: DeletableItem, | 183 DeletableItem: DeletableItem, |
184 }; | 184 }; |
185 }); | 185 }); |
OLD | NEW |