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