Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: chrome/browser/resources/print_preview/component.js

Issue 588713002: Compile print_preview, part 3: reduce down to 185 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@I_print_preview_2
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 }, 151 },
152 152
153 /** 153 /**
154 * @param {string} query Selector query to select an element starting from 154 * @param {string} query Selector query to select an element starting from
155 * the component's root element using a depth first search for the first 155 * the component's root element using a depth first search for the first
156 * element that matches the query. 156 * element that matches the query.
157 * @return {!HTMLElement} Element selected by the given query. 157 * @return {!HTMLElement} Element selected by the given query.
158 */ 158 */
159 getChildElement: function(query) { 159 getChildElement: function(query) {
160 return assert(this.element_.querySelector(query)); 160 return assertInstanceof(this.element_.querySelector(query), HTMLElement);
161 }, 161 },
162 162
163 /** 163 /**
164 * Sets the component's element. 164 * Sets the component's element.
165 * @param {Element} element HTML element to set as the component's element. 165 * @param {Element} element HTML element to set as the component's element.
166 * @protected 166 * @protected
167 */ 167 */
168 setElementInternal: function(element) { 168 setElementInternal: function(element) {
169 this.element_ = element; 169 this.element_ = element;
170 }, 170 },
171 171
172 /** 172 /**
173 * Decorates the given element for use as the element of the component. 173 * Decorates the given element for use as the element of the component.
174 * @protected 174 * @protected
175 */ 175 */
176 decorateInternal: function() { /*abstract*/ }, 176 decorateInternal: function() { /*abstract*/ },
177 177
178 /** 178 /**
179 * Clones a template HTML DOM tree. 179 * Clones a template HTML DOM tree.
180 * @param {string} templateId Template element ID. 180 * @param {string} templateId Template element ID.
181 * @param {boolean=} opt_keepHidden Whether to leave the cloned template 181 * @param {boolean=} opt_keepHidden Whether to leave the cloned template
182 * hidden after cloning. 182 * hidden after cloning.
183 * @return {Element} Cloned element with its 'id' attribute stripped. 183 * @return {Element} Cloned element with its 'id' attribute stripped.
184 * @protected 184 * @protected
185 */ 185 */
186 cloneTemplateInternal: function(templateId, opt_keepHidden) { 186 cloneTemplateInternal: function(templateId, opt_keepHidden) {
187 var templateEl = $(templateId); 187 var templateEl = $(templateId);
188 assert(templateEl != null, 188 assert(templateEl != null,
189 'Could not find element with ID: ' + templateId); 189 'Could not find element with ID: ' + templateId);
190 var el = templateEl.cloneNode(true); 190 var el = assertInstanceof(templateEl.cloneNode(true), HTMLElement);
191 el.id = ''; 191 el.id = '';
192 if (!opt_keepHidden) { 192 if (!opt_keepHidden) {
193 setIsVisible(el, true); 193 setIsVisible(el, true);
194 } 194 }
195 return el; 195 return el;
196 } 196 }
197 }; 197 };
198 198
199 return { 199 return {
200 Component: Component 200 Component: Component
201 }; 201 };
202 }); 202 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698