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 /** @override */ | 145 /** @override */ |
146 decorate: function() { | 146 decorate: function() { |
147 List.prototype.decorate.call(this); | 147 List.prototype.decorate.call(this); |
148 this.addEventListener('click', this.handleClick); | 148 this.addEventListener('click', this.handleClick); |
149 this.addEventListener('keydown', this.handleKeyDown_); | 149 this.addEventListener('keydown', this.handleKeyDown_); |
150 }, | 150 }, |
151 | 151 |
152 /** | 152 /** |
153 * Callback for onclick events. | 153 * Callback for onclick events. |
154 * @param {Event} e The click event object. | 154 * @param {Event} e The click event object. |
155 * @override | 155 * @protected |
156 */ | 156 */ |
157 handleClick: function(e) { | 157 handleClick: function(e) { |
158 if (this.disabled) | 158 if (this.disabled) |
159 return; | 159 return; |
160 | 160 |
161 var target = e.target; | 161 var target = e.target; |
162 if (target.classList.contains('row-delete-button')) { | 162 if (target.classList.contains('row-delete-button')) { |
163 var listItem = this.getListItemAncestor( | 163 var listItem = this.getListItemAncestor( |
164 /** @type {HTMLElement} */(target)); | 164 /** @type {HTMLElement} */(target)); |
165 var idx = this.getIndexOfListItem(listItem); | 165 var idx = this.getIndexOfListItem(listItem); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 */ | 205 */ |
206 deleteItemAtIndex: function(index) { | 206 deleteItemAtIndex: function(index) { |
207 }, | 207 }, |
208 }; | 208 }; |
209 | 209 |
210 return { | 210 return { |
211 DeletableItemList: DeletableItemList, | 211 DeletableItemList: DeletableItemList, |
212 DeletableItem: DeletableItem, | 212 DeletableItem: DeletableItem, |
213 }; | 213 }; |
214 }); | 214 }); |
OLD | NEW |