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

Side by Side Diff: chrome/browser/resources/options/deletable_item_list.js

Issue 6372005: DOMUI Prefs: Fix close buttons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« 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 (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
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
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 });
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