| 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 |
| 11 * @extends {cr.EventTarget} | 11 * @extends {cr.EventTarget} |
| 12 */ | 12 */ |
| 13 function Component() { | 13 function Component() { |
| 14 cr.EventTarget.call(this); | 14 cr.EventTarget.call(this); |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Component's HTML element. | 17 * Component's HTML element. |
| 18 * @private {Element} | 18 * @private {Element} |
| 19 */ | 19 */ |
| 20 this.element_ = null; | 20 this.element_ = null; |
| 21 | 21 |
| 22 this.isInDocument_ = false; | 22 this.isInDocument_ = false; |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * Component's event tracker. | 25 * Component's event tracker. |
| 26 * @private {!EventTracker} | 26 * @private {!EventTracker} |
| 27 */ | 27 */ |
| 28 this.tracker_ = new EventTracker(); | 28 this.tracker_ = new EventTracker(); |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Component's WebUI listener tracker. | 31 * Component's WebUI listener tracker. |
| 32 * @private {!WebUIListenerTracker} | 32 * @private {!WebUIListenerTracker} |
| 33 */ | 33 */ |
| 34 this.listenerTracker_ = new WebUIListenerTracker(); | 34 this.listenerTracker_ = new WebUIListenerTracker(); |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Child components of the component. | 37 * Child components of the component. |
| 38 * @private {!Array<!print_preview.Component>} | 38 * @private {!Array<!print_preview.Component>} |
| 39 */ | 39 */ |
| 40 this.children_ = []; | 40 this.children_ = []; |
| 41 } | 41 } |
| 42 | 42 |
| 43 Component.prototype = { | 43 Component.prototype = { |
| 44 __proto__: cr.EventTarget.prototype, | 44 __proto__: cr.EventTarget.prototype, |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 /** | 196 /** |
| 197 * Clones a template HTML DOM tree. | 197 * Clones a template HTML DOM tree. |
| 198 * @param {string} templateId Template element ID. | 198 * @param {string} templateId Template element ID. |
| 199 * @param {boolean=} opt_keepHidden Whether to leave the cloned template | 199 * @param {boolean=} opt_keepHidden Whether to leave the cloned template |
| 200 * hidden after cloning. | 200 * hidden after cloning. |
| 201 * @return {Element} Cloned element with its 'id' attribute stripped. | 201 * @return {Element} Cloned element with its 'id' attribute stripped. |
| 202 * @protected | 202 * @protected |
| 203 */ | 203 */ |
| 204 cloneTemplateInternal: function(templateId, opt_keepHidden) { | 204 cloneTemplateInternal: function(templateId, opt_keepHidden) { |
| 205 var templateEl = $(templateId); | 205 var templateEl = $(templateId); |
| 206 assert(templateEl != null, | 206 assert( |
| 207 'Could not find element with ID: ' + templateId); | 207 templateEl != null, 'Could not find element with ID: ' + templateId); |
| 208 var el = assertInstanceof(templateEl.cloneNode(true), HTMLElement); | 208 var el = assertInstanceof(templateEl.cloneNode(true), HTMLElement); |
| 209 el.id = ''; | 209 el.id = ''; |
| 210 if (!opt_keepHidden) { | 210 if (!opt_keepHidden) { |
| 211 setIsVisible(el, true); | 211 setIsVisible(el, true); |
| 212 } | 212 } |
| 213 return el; | 213 return el; |
| 214 } | 214 } |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 return { | 217 return {Component: Component}; |
| 218 Component: Component | |
| 219 }; | |
| 220 }); | 218 }); |
| OLD | NEW |