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('print_preview', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Class that represents a UI component. | 9 * Class that represents a UI component. |
10 * @constructor | 10 * @constructor |
(...skipping 17 matching lines...) Expand all Loading... |
28 * @private | 28 * @private |
29 */ | 29 */ |
30 this.tracker_ = new EventTracker(); | 30 this.tracker_ = new EventTracker(); |
31 | 31 |
32 /** | 32 /** |
33 * Child components of the component. | 33 * Child components of the component. |
34 * @type {!Array<!print_preview.Component>} | 34 * @type {!Array<!print_preview.Component>} |
35 * @private | 35 * @private |
36 */ | 36 */ |
37 this.children_ = []; | 37 this.children_ = []; |
38 }; | 38 } |
39 | 39 |
40 Component.prototype = { | 40 Component.prototype = { |
41 __proto__: cr.EventTarget.prototype, | 41 __proto__: cr.EventTarget.prototype, |
42 | 42 |
43 /** Gets the component's element. */ | 43 /** Gets the component's element. */ |
44 getElement: function() { | 44 getElement: function() { |
45 return this.element_; | 45 return this.element_; |
46 }, | 46 }, |
47 | 47 |
48 /** @return {EventTracker} Component's event tracker. */ | 48 /** @return {EventTracker} Component's event tracker. */ |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 }, | 159 }, |
160 | 160 |
161 /** | 161 /** |
162 * @param {string} query Selector query to select an element starting from | 162 * @param {string} query Selector query to select an element starting from |
163 * the component's root element using a depth first search for the first | 163 * the component's root element using a depth first search for the first |
164 * element that matches the query. | 164 * element that matches the query. |
165 * @return {!HTMLElement} Element selected by the given query. | 165 * @return {!HTMLElement} Element selected by the given query. |
166 */ | 166 */ |
167 getChildElement: function(query) { | 167 getChildElement: function(query) { |
168 return assert(this.element_.querySelector(query)); | 168 return /** @type {!HTMLElement} */ ( |
| 169 assert(this.element_.querySelector(query))); |
169 }, | 170 }, |
170 | 171 |
171 /** | 172 /** |
172 * Sets the component's element. | 173 * Sets the component's element. |
173 * @param {Element} element HTML element to set as the component's element. | 174 * @param {Element} element HTML element to set as the component's element. |
174 * @protected | 175 * @protected |
175 */ | 176 */ |
176 setElementInternal: function(element) { | 177 setElementInternal: function(element) { |
177 this.element_ = element; | 178 this.element_ = element; |
178 }, | 179 }, |
(...skipping 22 matching lines...) Expand all Loading... |
201 setIsVisible(el, true); | 202 setIsVisible(el, true); |
202 } | 203 } |
203 return el; | 204 return el; |
204 } | 205 } |
205 }; | 206 }; |
206 | 207 |
207 return { | 208 return { |
208 Component: Component | 209 Component: Component |
209 }; | 210 }; |
210 }); | 211 }); |
OLD | NEW |