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 // require: listselectionmodel.js | 5 // require: listselectionmodel.js |
6 | 6 |
7 /** | 7 /** |
8 * @fileoverview This implements a list control. | 8 * @fileoverview This implements a list control. |
9 */ | 9 */ |
10 | 10 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 var dataModel = this.dataModel; | 216 var dataModel = this.dataModel; |
217 if (dataModel) { | 217 if (dataModel) { |
218 return indexes.map(function(i) { | 218 return indexes.map(function(i) { |
219 return dataModel.item(i); | 219 return dataModel.item(i); |
220 }); | 220 }); |
221 } | 221 } |
222 return []; | 222 return []; |
223 }, | 223 }, |
224 | 224 |
225 /** | 225 /** |
226 * The HTML elements representing the items. This is just all the element | 226 * The HTML elements representing the items. This is just all the list item |
227 * children but subclasses may override this to filter out certain elements. | 227 * children but subclasses may override this to filter out certain elements. |
228 * @type {HTMLCollection} | 228 * @type {HTMLCollection} |
229 */ | 229 */ |
230 get items() { | 230 get items() { |
231 return this.children; | 231 return Array.prototype.filter.call(this.children, function(child) { |
| 232 return !child.classList.contains('spacer'); |
| 233 }); |
232 }, | 234 }, |
233 | 235 |
234 batchCount_: 0, | 236 batchCount_: 0, |
235 | 237 |
236 /** | 238 /** |
237 * When making a lot of updates to the list, the code could be wrapped in | 239 * When making a lot of updates to the list, the code could be wrapped in |
238 * the startBatchUpdates and finishBatchUpdates to increase performance. Be | 240 * the startBatchUpdates and finishBatchUpdates to increase performance. Be |
239 * sure that the code will not return without calling endBatchUpdates or the | 241 * sure that the code will not return without calling endBatchUpdates or the |
240 * list will not be correctly updated. | 242 * list will not be correctly updated. |
241 */ | 243 */ |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 } | 572 } |
571 } | 573 } |
572 }; | 574 }; |
573 | 575 |
574 cr.defineProperty(List, 'disabled', cr.PropertyKind.BOOL_ATTR); | 576 cr.defineProperty(List, 'disabled', cr.PropertyKind.BOOL_ATTR); |
575 | 577 |
576 return { | 578 return { |
577 List: List | 579 List: List |
578 } | 580 } |
579 }); | 581 }); |
OLD | NEW |