| 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 * @type {Element} | 18 * @type {Element} |
| 19 * @private | 19 * @private |
| 20 */ | 20 */ |
| 21 this.element_ = null; | 21 this.element_ = null; |
| 22 | 22 |
| 23 this.isInDocument_ = false; | 23 this.isInDocument_ = false; |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Component's event tracker. | 26 * Component's event tracker. |
| 27 * @type {EventTracker} | 27 * @type {EventTracker} |
| 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 = { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 /** | 188 /** |
| 189 * Clones a template HTML DOM tree. | 189 * Clones a template HTML DOM tree. |
| 190 * @param {string} templateId Template element ID. | 190 * @param {string} templateId Template element ID. |
| 191 * @param {boolean=} opt_keepHidden Whether to leave the cloned template | 191 * @param {boolean=} opt_keepHidden Whether to leave the cloned template |
| 192 * hidden after cloning. | 192 * hidden after cloning. |
| 193 * @return {Element} Cloned element with its 'id' attribute stripped. | 193 * @return {Element} Cloned element with its 'id' attribute stripped. |
| 194 * @protected | 194 * @protected |
| 195 */ | 195 */ |
| 196 cloneTemplateInternal: function(templateId, opt_keepHidden) { | 196 cloneTemplateInternal: function(templateId, opt_keepHidden) { |
| 197 var templateEl = $(templateId); | 197 var templateEl = $(templateId); |
| 198 assert(templateEl != null, | 198 assert( |
| 199 'Could not find element with ID: ' + templateId); | 199 templateEl != null, 'Could not find element with ID: ' + templateId); |
| 200 var el = assertInstanceof(templateEl.cloneNode(true), HTMLElement); | 200 var el = assertInstanceof(templateEl.cloneNode(true), HTMLElement); |
| 201 el.id = ''; | 201 el.id = ''; |
| 202 if (!opt_keepHidden) { | 202 if (!opt_keepHidden) { |
| 203 setIsVisible(el, true); | 203 setIsVisible(el, true); |
| 204 } | 204 } |
| 205 return el; | 205 return el; |
| 206 } | 206 } |
| 207 }; | 207 }; |
| 208 | 208 |
| 209 return { | 209 return {Component: Component}; |
| 210 Component: Component | |
| 211 }; | |
| 212 }); | 210 }); |
| OLD | NEW |