OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 /** | 5 /** |
6 * Javascript for ExpandableList and ExpandableListItem, served from | 6 * Javascript for ExpandableList and ExpandableListItem, served from |
7 * chrome://bluetooth-internals/. | 7 * chrome://bluetooth-internals/. |
8 */ | 8 */ |
9 | 9 |
10 cr.define('expandable_list', function() { | 10 cr.define('expandable_list', function() { |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 /** | 24 /** |
25 * Decorates the element as an expandable list item and caches the created | 25 * Decorates the element as an expandable list item and caches the created |
26 * content holders for implementations. | 26 * content holders for implementations. |
27 * @override | 27 * @override |
28 */ | 28 */ |
29 decorate: function() { | 29 decorate: function() { |
30 this.classList.add('expandable-list-item'); | 30 this.classList.add('expandable-list-item'); |
31 this.briefContent_ = document.createElement('div'); | 31 this.briefContent_ = document.createElement('div'); |
32 this.briefContent_.classList.add('brief-content'); | 32 this.briefContent_.classList.add('brief-content'); |
33 this.briefContent_.addEventListener( | 33 this.briefContent_.addEventListener('click', this.onExpand_.bind(this)); |
34 'click', this.onExpand_.bind(this)); | |
35 this.appendChild(this.briefContent_); | 34 this.appendChild(this.briefContent_); |
36 | 35 |
37 this.expandedContent_ = document.createElement('div'); | 36 this.expandedContent_ = document.createElement('div'); |
38 this.expandedContent_.classList.add('expanded-content'); | 37 this.expandedContent_.classList.add('expanded-content'); |
39 this.appendChild(this.expandedContent_); | 38 this.appendChild(this.expandedContent_); |
40 }, | 39 }, |
41 | 40 |
42 /** | 41 /** |
43 * Called when the list item is expanded or collapsed. | 42 * Called when the list item is expanded or collapsed. |
44 * @param {boolean} expanded | 43 * @param {boolean} expanded |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 updateMessageDisplay_: function() { | 131 updateMessageDisplay_: function() { |
133 this.emptyMessage_.hidden = this.dataModel.length > 0; | 132 this.emptyMessage_.hidden = this.dataModel.length > 0; |
134 }, | 133 }, |
135 }; | 134 }; |
136 | 135 |
137 return { | 136 return { |
138 ExpandableListItem: ExpandableListItem, | 137 ExpandableListItem: ExpandableListItem, |
139 ExpandableList: ExpandableList, | 138 ExpandableList: ExpandableList, |
140 }; | 139 }; |
141 }); | 140 }); |
OLD | NEW |